Skip to content

Instantly share code, notes, and snippets.

Andrew Farmer ahfarmer

Block or report user

Report or block ahfarmer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ahfarmer / jsdom.js
Last active May 7, 2016
jsdom with mocha
View jsdom.js
var jsdom = require('jsdom')
// setup the simplest document possible
var doc = jsdom.jsdom('<!doctype html><html><body></body></html>')
// get the window object out of the document
var win = doc.defaultView
// set globals for mocha that make access to document and window feel
// natural in the test environment
ahfarmer / snippet.js
Last active Apr 20, 2016
Google Analytics Snippet Unminified
View snippet.js
// Source
// Original
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
// Unminified
ahfarmer / .gitignore
Created Oct 28, 2015
browsersync rewriterules not used
View .gitignore
View docwrite.html
<script type='text/javascript'>
document.write('<script type=\"text/javascript\" src=""><\/scr'+'ipt>');
<script type='text/javascript'>
View .eslintrc
"extends": "airbnb",
"env": {
"mocha": true,
"browser": true,
"node": true
"rules": {
"no-undef": 2,
"comma-dangle": 0,
View blah.js
import React, { PropTypes } from 'react'
import Emoji from 'emojione'
var Emojify = React.createClass({
convert(line) {
let data = line.match(/\<img class\=\"([^"]*)\" alt\=\"([^"]*)\" src\=\"([^"]*)\"\/\>/i)
//return data[2]
return (
ahfarmer /
Last active Aug 29, 2015
npm shrinkwrap validation errors
# ESLint is at 1.0.0 in package.json
$ cat package.json
"name": "npm-shrinkwrap-test",
"version": "0.0.1",
"dependencies": {
"eslint": "1.0.0"
View jsx-example.js
/** @jsx createNode */
function createNode(tagName, attrs, ...children) {
const node = attrs || {}; = tagName;
if (children && children.length > 0) {
node.children = children;
return node;
ahfarmer /
Created Jun 3, 2015
Chokidar alwaysStat issue

Chokidar alwaysStat issue

Project for reproducing issue 9 in the chokidar library.


First install the packages with:

ahfarmer / footer.m
Created May 1, 2015
animate footer up
View footer.m
You can’t perform that action at this time.