Skip to content

Instantly share code, notes, and snippets.

View joelgriffith's full-sized avatar
💻
Turns out I'm really good at computers

Joel Griffith joelgriffith

💻
Turns out I'm really good at computers
View GitHub Profile
@joelgriffith
joelgriffith / .zshrc
Last active December 21, 2015 07:18
Zero Shell Preferences
#########################
## ZSH
#########################
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="ys"
#########################
## PLUGINS
#########################
plugins=(git npm node sublime)
@joelgriffith
joelgriffith / gist:6771841
Created September 30, 2013 23:32
Cors Handler
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
// Check if the XMLHttpRequest object has a "withCredentials" property.
// "withCredentials" only exists on XMLHTTPRequest2 objects.
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {
@joelgriffith
joelgriffith / gist:7000453
Last active December 25, 2015 15:48
Helpful git commands
# Add a remote repository at URL named NAME
git remote add NAME URL
# Show me my local branches
git branch -a
# Show me my remote repositories
git remote -v
# Create a new local branch with NAME and switch to it
@joelgriffith
joelgriffith / Module.js
Last active August 29, 2015 13:55
The End-all JavaScript Module Wrapper
/*
* The end-all module detection/exportation
*/
(function(base, factory) {
// RequireJS
if (typeof define === "function" && define.amd) {
define(factory);
// CommonJS
/*
* Module Wrapper
*/
(function (base, factory) {
'use strict';
// RequireJS
if (typeof define === 'function' && define.amd) {
define(factory);
@joelgriffith
joelgriffith / object-watch.js
Last active August 29, 2015 13:57 — forked from eligrey/object-watch.js
Object Watch Polyfill
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@joelgriffith
joelgriffith / Sinon-chain.js
Created December 1, 2014 15:56
Chaining Sinon Stubs
/**
* test.mpsec.js
*/
var sinon = require('sinon');
var expect = require('chai').expect;
var rewire = require('rewire');
var main = rewire('main');
var CoolModuleMock = (function() {
function CoolModuleMock() {}
@joelgriffith
joelgriffith / gist:dc4024a718fa0e9a1bd2
Created January 5, 2015 16:40
Change Shell to ZSH when passwords aren't known
# Mount FS as read/write
mount -rw -o remount /
# Delete old passwd...
sudo passwd -d <USERNAME>
# Set passwd
passwd
# Set shell!
" Preferences
set number
syntax on
set nocompatible " be iMproved, required
filetype off " required
set tabstop=4
set softtabstop=4
" Set tabs to a > character
set list
@joelgriffith
joelgriffith / index.jsx
Last active June 23, 2017 12:25
apollo-client in your reducer tree as opposed to HOC
// External dependencies
import React from 'react';
import thunk from 'redux-thunk';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { routerReducer } from 'react-router-redux';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
import ApolloClient, { createNetworkInterface } from 'apollo-client';