Skip to content

Instantly share code, notes, and snippets.

View iammerrick's full-sized avatar

Merrick Christensen iammerrick

View GitHub Profile
@sebmarkbage
sebmarkbage / The Rules.md
Last active December 7, 2024 18:30
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@1000hz
1000hz / nested_ternaries.js
Created April 18, 2014 20:21
Nested ternaries can be nice if you do it right...
function dessertRank(dessert) {
return dessert === "muffins" ? "good"
: dessert === "brownies" ? "pretty good"
: dessert === "cupcakes" ? "great"
: dessert === "cookies" ? "amazing"
: dessert === "cake" ? "omg"
: dessert === "ice cream" ? "dying"
: "probably pretty great"
@geddski
geddski / service-demystification-test.js
Created June 19, 2013 16:40
Demystification of Angular's services.
var expect = chai.expect;
describe('services', function(){
var goat, monkey, monkey2, Donkey, tiger1, tiger2, lion;
beforeEach(function(){
//load the module
module('app');
//configure providers
@balupton
balupton / docpad.coffee
Created September 11, 2012 04:21
DocPad: Custom Routing
# =================================
# DocPad Events
# Here we can define handlers for events that DocPad fires
# You can find a full listing of events on the DocPad Wiki
events:
# Server Extend
# Used to add our own custom routes to the server before the docpad routes are added
serverExtend: (opts) ->
@gre
gre / easing.js
Last active December 30, 2024 12:19
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt