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 / .gitignore
Last active August 29, 2015 14:03
Replicate Atom-Shell Stall/Idle Problem
Atom.app
@cpsubrian
cpsubrian / card.js
Last active August 29, 2015 14:05
Test Card
variables.first = makeFirst(variables.first);
function makeFirst (first) {
return first + '(made)';
}
@cpsubrian
cpsubrian / .vimrc
Created June 11, 2015 00:01
vim stuff
" be iMproved, required
set nocompatible
" required
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@cpsubrian
cpsubrian / historyActions.js
Last active September 3, 2015 20:40
A stab at a redux history (undo/redo) 'transducer' utilizing Immutable.js
/**
* History action creators.
*/
import * as types from '../types'
export function resetHistory () {
return {type: types.HISTORY_RESET}
}
@cpsubrian
cpsubrian / README.md
Created September 21, 2015 19:42
Scrolly Box Pop-in

Usage

$ [clone this gist]
$ hipley --dev
$ open http://localhost:3000
``
@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 / 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 / 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 / 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 / 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