Skip to content

Instantly share code, notes, and snippets.

View DarrylD's full-sized avatar
💭
daydreaming

Darryl D. DarrylD

💭
daydreaming
View GitHub Profile

Usage

  1. npm install babel-loader imports-loader webpack --save
  2. Create webpack.config.js
  3. Move index.ios.js to src/index.ios.jsx
  4. webpack --watch

Example

src/index.ios.jsx

@EmielM
EmielM / rollup.config.js
Created July 27, 2017 12:48
react-native rollup bundle attempt
import fs from 'fs';
import path from 'path';
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import replace from 'rollup-plugin-replace';
function findVersion(file, extensions) {
for (let e of extensions) {
@benatkin
benatkin / Global.sublime-settings
Created July 20, 2011 04:26
excluding node_modules from Sublime Text 2
// Place user-specific overrides in this file, to ensure they're preserved
// when upgrading
{
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"]
}
@DimitryDushkin
DimitryDushkin / react-router-queyry-utils.js
Last active March 5, 2021 13:38
React router utility functions to add and remove queries
import { browserHistory } from 'react-router';
/**
* @param {Object} query
*/
export const addQuery = (query) => {
const location = Object.assign({}, browserHistory.getCurrentLocation());
Object.assign(location.query, query);
browserHistory.push(location);
};
@bmaeser
bmaeser / subtitle-extract.txt
Created September 2, 2011 23:25
extract subtitles from *.mkv-files on osx
lines with $ are commands
### install mkvtoolnix:
$ brew install mkvtoolnix
### list content of the mkv-file:
$ mkvmerge -i mymoviefile.mkv
### what will give you:
@corpix
corpix / backbone-router-filter.js
Created March 4, 2012 13:00
Backbone router before,after,leave
(function(Backbone, _) {
var leave;
_.extend(Backbone.Router.prototype, Backbone.Events, {
route : function(route, name, callback) {
var before
, fn = callback
, after;
Backbone.history || (Backbone.history = new Backbone.History);
@mohsen1
mohsen1 / reactor.js
Last active January 15, 2022 21:57
Reactor Pattern in JavaScript
function Event(name){
this.name = name;
this.callbacks = [];
}
Event.prototype.registerCallback = function(callback){
this.callbacks.push(callback);
}
function Reactor(){
this.events = {};
@ericelliott
ericelliott / impure-action-creator.js
Last active March 28, 2022 21:58
Impure Action Creator
// Action creators can be impure.
export const addChat = ({
// cuid is safer than random uuids/v4 GUIDs
// see usecuid.org
id = cuid(),
msg = '',
user = 'Anonymous',
timeStamp = Date.now()
} = {}) => ({
type: ADD_CHAT,
@abhiaiyer91
abhiaiyer91 / reduxSelectorPattern.md
Last active April 29, 2022 06:00
Redux Selector Pattern

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default: