Skip to content

Instantly share code, notes, and snippets.

View cpsubrian's full-sized avatar

Brian Link cpsubrian

  • Dropbox
  • Fremont, CA
View GitHub Profile
@cpsubrian
cpsubrian / README.md
Last active October 28, 2016 15:32
Styler - Meldium Launchpad

Styler Injector for Meldium Launchpad

Pasted the following into the styler JS area:

var gistUrl = 'https://gist.githubusercontent.com/cpsubrian/f9cd249f981c0870305421fb4d3a410c/raw';
$.get(gistUrl + '/styles.css?v=' + Date.now(), function (result) {
  $('#stylerStyle').after('<style>' + result + '</style>'); 
});
@cpsubrian
cpsubrian / README.md
Last active March 27, 2023 13:34
React decorators for redux/react-router/immutable 'smart' components.

This is my typical decorator stack for a 'smart component' used as the component for react-router route. Note some code is missing here but this should give you the idea.

Example usage:

StateDetailsScene.js

import React from 'react'
import _ from 'lodash'
import route from 'core/decorators/route'
@cpsubrian
cpsubrian / console.txt
Created July 21, 2016 17:47
react-native realm crash
2016-07-21 10:44:30.968 [error][tid:com.facebook.react.JavaScript] create@[native code]
file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:576:849
write@[native code]
save@file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:576:816
u@file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:578:451
save@file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:578:1008
file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:573:511
f@file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:301:187
d@file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:301:1579
c@file:///var/containers/Bundle/Application/60FA3246-6B52-4A8A-B47E-D0AAB4D65D5B/ESA.app/main.jsbundle:301:435
@cpsubrian
cpsubrian / HomeScene.js
Last active July 11, 2016 18:10
react-router-native dynamic header via redux
import React from 'react'
import {View, Image, Text, TouchableHighlight} from 'react-native'
import {Link} from 'react-router-native'
import Scene from 'core/components/scene/Scene'
import styles from './HomeScene.styles'
class HomeScene extends React.Component {
render () {
return (
@cpsubrian
cpsubrian / AppDelegate.m
Created July 5, 2016 19:55
Auto-IP Detection React-Native 0.28.0
// ...
NSURL *jsCodeLocation;
/**
* This Replaces the regular OPTION1/OPTION2 business with the hard-coded IPs.
* @see https://gist.github.com/cpsubrian/5f3acf2b9ed1212ee33703a6bee63737
* @see http://moduscreate.com/automated-ip-configuration-for-react-native-development/
* @see https://github.com/facebook/react-native/pull/4681/files
*/
#define AUTO_IP
@cpsubrian
cpsubrian / README.md
Last active March 15, 2016 20:31
Redux folder structure

Organize by Verb

  • actions/
    • campaigns.js
  • components/
    • Campaign.js
    • Campaigns.js
  • models/
    • campaign.js
  • reducers/
@cpsubrian
cpsubrian / package.json
Created March 15, 2016 20:15
Symlink app root alias in package.json
{
"name": "example",
"scripts": {
"postinstall" : "node -e \"var s='../src/js',d='node_modules/@app',fs=require('fs');fs.exists(d,function(exists){exists||fs.symlinkSync(s,d,'dir')});\""
}
}
@cpsubrian
cpsubrian / model.js
Last active March 8, 2016 19:57
Immutable.Record for models
import _ from 'lodash'
import idgen from 'idgen'
import {List, Map, Record} from 'immutable'
import serialize from '../lib/serialize'
// Wraps a schema to provide the default values that an Immutable Record needs.
export default function CreateModel (schema, name = 'Model') {
// Create a 'defaults' object for the Record factory.
let defaults = _.reduce(schema, (result, opts, key) => {
return _.extend(result, {
@cpsubrian
cpsubrian / Preferences.sublime-settings
Last active January 6, 2016 21:37
SublimeText Setup for React Stuff
{
"auto_complete": false,
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai Extended (SL).tmTheme",
"font_face": "Source Code Pro",
"font_size": 13.0,
"ignored_packages":
[
"Vintage"
],
@cpsubrian
cpsubrian / README.md
Created September 21, 2015 19:42
Scrolly Box Pop-in

Usage

$ [clone this gist]
$ hipley --dev
$ open http://localhost:3000
``