Skip to content

Instantly share code, notes, and snippets.

View IanVS's full-sized avatar

Ian VanSchooten IanVS

View GitHub Profile
@justinwoo
justinwoo / using-rxjs-instead-of-flux-with-react.md
Last active October 21, 2023 10:16
Using RxJS instead of Flux with React to organize data flow

Reposted from Qiita

For almost a year now, I've been using this "flux" architecture to organize my React applications and to work on other people's projects, and its popularity has grown quite a lot, to the point where it shows up on job listings for React and a lot of people get confused about what it is.

Why I'm tired of using and teaching flux

There are a billion explainations on the internet, so I'll skip explaining the parts. Instead, let's cut to the chase -- the main parts I hate about flux are the Dispatcher and the Store's own updating mechanism.

If you use a setup similar to the examples in facebook/flux, and you use flux.Dispatcher, you probably have this kind of flow:

@mphasize
mphasize / beforeBlueprint.js
Created March 2, 2015 12:31
Sails-beforeBlueprint-Policy
/**
* beforeBlueprint
*
* @module :: Policy
* @description :: Simple policy to enable hooks into the model which can act upon req, res objects.
* @docs :: http://sailsjs.org/#!documentation/policies
*
*/
var actionUtil = require( 'sails/lib/hooks/blueprints/actionUtil' );
@LeoCavaille
LeoCavaille / .gitconfig
Last active June 23, 2020 09:17
How to properly rebase and deal with a contributor's PR
[alias]
checkoutpr = "!f() { git fetch origin refs/pull/$1/head:pr/$1; git checkout pr/$1; } ; f"
checkoutcontrib = "!f() { git checkout master && git pull && git remote add $1 git@github.com:$1/dd-agent && git fetch $1 $2 && git checkout -b $3 $1/$2 && git rebase master } ; f"
# Add this to .zshrc for VIM modes in shell....holy shit, amazing!!!!
# although this does effect the ability to scroll through bash history with ctlr+p, ctrl+n, if ctrl is remapped to cap locks via
# system preferences
bindkey -v
# preferences > keys -- hotkey to open iterm = option+space
# preferences > keys -- change hotkeys for moving previous/next tabs to more similar to VIM, combo with h (previous) l (next)
# preferences > profiles > keys -- right and/or left option key to +Esc, allows easier navigating of words in command line
commands:
@staltz
staltz / introrx.md
Last active May 2, 2024 12:31
The introduction to Reactive Programming you've been missing
@uhho
uhho / node nginx configuration
Created October 4, 2013 01:16
Sample nginx configuration for NodeJS + SocketIO app
# Load balancer configuration
upstream exampleApp {
# Directs to the process with least number of connections.
least_conn;
# One failed response will take a server out of circulation for 20 seconds.
server 127.0.0.1:10080 fail_timeout=20s;
#server 127.0.0.1:10081 fail_timeout=20s;
#server 127.0.0.1:10082 fail_timeout=20s;
#server 127.0.0.1:10083 fail_timeout=20s;
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@domenic
domenic / portable-node.md
Created May 25, 2012 21:03
Tips for Writing Portable Node.js Code

Node.js core does its best to treat every platform equally. Even if most Node developers use OS X day to day, some use Windows, and most everyone deploys to Linux or Solaris. So it's important to keep your code portable between platforms, whether you're writing a library or an application.

Predictably, most cross-platform issues come from Windows. Things just work differently there! But if you're careful, and follow some simple best practices, your code can run just as well on Windows systems.

Paths and URLs

On Windows, paths are constructed with backslashes instead of forward slashes. So if you do your directory manipulation

@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",