Skip to content

Instantly share code, notes, and snippets.

View grundmanise's full-sized avatar
🔮
It's magic

Edgar grundmanise

🔮
It's magic
View GitHub Profile
@grundmanise
grundmanise / rxjs.ajax.js
Created February 12, 2018 13:57
RXJS Ajax example
const searchEpic = (action$, store) =>
action$.ofType('SEARCH')
.map(action => action.payload)
.debounceTime(400)
.switchMap(query =>
ajax.post('http://localhost:8080/search', {query})
.takeUntil(action$.ofType('CANCEL_SEARCH')))
.map(res => ({type: 'SEARCH_DATA', result: res.response}))
@grundmanise
grundmanise / shallowEqual.js
Created December 7, 2017 09:41
Shallow equal fbjs
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule shallowEqual
* @typechecks
* @flow
*/
@grundmanise
grundmanise / haversine.js
Last active June 5, 2017 13:20
Get distance between two points (return distance in meters)
const calculateDistance = (pointA, pointB) => {
// http://www.movable-type.co.uk/scripts/latlong.html
const lat1 = pointA.coordinate.latitude;
const lon1 = pointA.coordinate.longitude;
const lat2 = pointB.coordinate.latitude;
const lon2 = pointB.coordinate.longitude;
const R = 6371e3; // earth radius in meters
function getLinkedListLength(A = [1,4,-1,3,2]) {
let count = 0;
let current = 0;
while(current !== -1) {
if (A.length < current)
throw Error(`No link found for value: ${current}. Count: ${count}`);
current = A[current];
count++;
@grundmanise
grundmanise / Readme.md
Last active November 1, 2018 13:30
React Native + React Native Navigation: launch images setup [iOS] (iPhone)

Personal note on how to setup launch images in RN when using RNN [iOS] (iPhone).

Preparation

Launch image sizes:

portrait

  1. Retina HD 5.5" : 1242 x 2208 px
  2. Retina HD 4.7" : 750 x 1334 px