Skip to content

Instantly share code, notes, and snippets.

View mcrowe's full-sized avatar

Mitch Crowe mcrowe

View GitHub Profile
@mcrowe
mcrowe / connect.js
Last active July 11, 2016 23:33
Simple flux example
import React from 'react'
import { createConnector } from '../lib/connector'
import DB from './db'
import env from '../config/environment'
import Logger from './logger'
const DebugError = ({error, componentDisplayName}) =>
<div cl="connect-error-debug">
<div cl="connect-error-message">{error.message}</div>
# Fetches stories from Hacker News and stores them in an sqlite db.
#
# Uses a thread pool of 25 works to do the http requests to make things
# faster.
#
# Usage:
# python fetch_hn_stories 1 1000
#
from hackernews import HackerNews
@mcrowe
mcrowe / turboreload.js
Last active August 29, 2015 14:06
TurboReload
// Generated by CoffeeScript 1.8.0
var turboReload;
turboReload = function() {
var browserCompatibleDocumentParser, documentParser, url;
browserCompatibleDocumentParser = function() {
var createDocumentUsingDOM, createDocumentUsingParser, createDocumentUsingWrite, e, testDoc, _ref;
createDocumentUsingParser = function(html) {
return (new DOMParser).parseFromString(html, 'text/html');
};
@mcrowe
mcrowe / capybara_session_factory.rb
Last active May 28, 2020 20:38
Saving and restoring Capybara sessions
module CapybaraSessionFactory
class SessionAlreadyDefined < StandardError; end
class SessionNotDefined < StandardError; end
# Parse a capybara session mode, which has the form
# "[driver]:[session_name]:[application_id]"
#
class CapybaraModeParser
@mcrowe
mcrowe / popup_blocker.js.coffee
Created December 6, 2011 21:05
Filter Popups
# Do nothing, silently, when window.open is called
window.open = () ->
@mcrowe
mcrowe / application.html.haml
Created December 6, 2011 19:07
Trapped in an Iframe - A horror story
%head
...
%link{rel: 'canonical', href: "http://[MyDomain].com#{request.path}"}
@mcrowe
mcrowe / dont_compress.js
Created November 7, 2011 22:33
Example of a script that grows when it is gzip compressed, for asset_sync testing.
(function(){new app.Autocompleter}).call(this)