Skip to content

Instantly share code, notes, and snippets.


Super overview of React!

Key nuggest:

  • React takes a functional programming approach on view rendering.
    • Angular and many others hold on to your data as well and tend to conform more to an MVC type patter, React allows you to write your views as functions (with some caveats)
    • Basically react lets you define "given the state of my data, what does my view look like right now?" as functions. Views are therefore very testable (ie call my component with 5 users with these names, I should see 5 cards with names displayed in header).
  • React has two major ways to define "Components"
    • functions (the pure functional way to write views)
function UserCard({user}) {
djoeman84 /
Last active Aug 2, 2017 — forked from orta/
Add flow to all your JS files
# Based on
find . -type f -iname "*.js" -print0 | while IFS= read -r -d $'\0' i;
if ! grep -q @flow $i
(echo "" & echo "/* @flow */") > flowificator
cat flowificator $i >$ && mv $ $i
rm flowificator
djoeman84 / stylePage.js
Last active Apr 10, 2017
Quick CSS setter
View stylePage.js
function stylePage(d){
for (var selector in d) {
if (!d.hasOwnProperty(selector)) return;
var properties = d[selector];
for (var styleName in properties) {
if (!properties.hasOwnProperty(styleName)) return;
var style = properties[styleName];
var matching = document.querySelectorAll(selector);
for (var j = 0; j < matching.length; j++) {
matching[j].style[styleName] = style;

Keybase proof

I hereby claim:

  • I am djoeman84 on github.
  • I am el_gato ( on keybase.
  • I have a public key whose fingerprint is 64D6 0F0F ECE3 35B0 C5A5 2B6B 4A5D 6A51 C7CE E24C

To claim this, I am signing this object:

View .bash_profile
djoeman84 / NoBackgroundScroll.js
Last active Jul 21, 2016
React Wrapper Component to disable scroll on child -no modern IE :(
View NoBackgroundScroll.js
import React, {Component} from 'react'
import $ from 'jquery'
export class NoBackgroundScroll extends Component {
componentDidMount() {
componentWillUnmount() {
djoeman84 /
Created May 25, 2016
Map Python object to ECMA-JSON compliant objects
import math
class JSONECMACompliance(object):
def make_standards_compliant(cls, json_serializable_obj, inf_value='Infinity',
negative_inf_value='-Infinity', nan_value='NaN'):
Python decided it wouldn't conform to ECMA JSON standard.
This converts illegal values (Infinity, -Infinity, NaN) to strings with the same values.
djoeman84 / Enable Spellcheck
Created Oct 29, 2013
A little bit of js to turn on spell checking on annoying pages that turn it off.
View Enable Spellcheck
var tareas = document.getElementsByTagName('textarea');
for (var i = 0; i < tareas.length; i++) {
tareas[i].spellcheck = true;
View gist:7140185
javascript:alert('You can download this video by using the command \'mimms -c '+document.getElementById('WMPlayer').data+' [target directory]\'');