This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ = require('lodash') | |
raw = { | |
main: { | |
pr: 1 | |
in: {} | |
out: [ | |
'login' | |
'tabs' | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
var workerFibo = createPromiseWorker(function(x){ | |
return (function fibo(n){ | |
if (n > 1) { | |
return fibo(n - 1) + fibo(n - 2); | |
} else { | |
return 1; | |
} | |
})(x) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* генерим react-компоненты из под серверных шаблонов */ | |
var ReactDOM = require('react-dom'); | |
var React = require('react'); | |
const findAndRender = (function () { | |
const options = { | |
className: 'jr', | |
classNameActivated: 'jr-activated' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {key: reducerFunc}, {key: initialReducerValue} | |
* */ | |
function createStore(reducers, initial) { | |
var _handle = function () { | |
}; | |
var _STATE = initial || {}, | |
_reducersNames = Object.keys(reducers); | |
return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {isString, assign, reduce, map, keys, isPlainObject, isNull} from 'lodash'; | |
export const isKeyValue = function isKeyValue(h) { | |
return isPlainObject(h) && !isNull(h) | |
}; | |
export const assignAt = function assignAt(hash, path, newValue) { | |
if (isKeyValue(path)) { | |
return assign({}, hash, | |
keys(path).reduce((memo, key) => assignAt(memo, key, path[key]), hash) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* todo: | |
* make the opacity-management buttons (remove from props) | |
* inside block (not only root) | |
* wrap block | |
* scrollable ! | |
* */ | |
import React, { Component, PropTypes } from 'react'; | |
import { | |
Text, View, StyleSheet, TouchableOpacity, Image, Dimensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AsyncStorage } from 'react-native'; | |
const JSONAsyncStorage = Object.assign({}, AsyncStorage, { | |
getItem() { | |
return AsyncStorage.getItem.apply(null, arguments).then((res) => JSON.parse(res)); | |
}, | |
setItem(key, value) { | |
return AsyncStorage.setItem(key, JSON.stringify(value)) | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Platform, StyleSheet } from 'react-native'; | |
function prepareStyles(stylesheet) { | |
return StyleSheet.create( | |
mapValues( | |
stylesheet, | |
function wrapPlatformSpecificRules(rules) { | |
rules['ios'] && rules['ios'] = Platform.select({'ios': rules['ios']}); | |
rules['android'] && rules['android'] = Platform.select({'android': rules['android']}) | |
return rules; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
* @flow | |
*/ | |
import React, {Component} from 'react'; | |
import { | |
AppRegistry, | |
StyleSheet, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.page-main * { | |
background: rgba(0, 0, 0, .025); | |
padding: 5px; | |
margin: 5px; | |
} | |
.page-main *:after { | |
content: attr(class); | |
font-size: 12px; | |
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; | |
font-style: italic; |