Skip to content

Instantly share code, notes, and snippets.

View DouglasLivingstone's full-sized avatar

Douglas Livingstone DouglasLivingstone

View GitHub Profile
@DouglasLivingstone
DouglasLivingstone / FluxActions.ts
Created October 15, 2015 09:00
Type-checking Flux actions in TypeScript
interface ActionClass<T extends Action> {
prototype: T;
}
// Base class for actions
abstract class Action {
type: string;
constructor() {
// Copy from the prototype onto the instance
this.type = this.type;
@pcreux
pcreux / gist:1681580
Created January 26, 2012 07:48
Reword *first* commit
# You can't use rebase -i here since it takes the parent commit as argument.
# You can do the following though:
git checkout FIRST_COMMIT_SHA && git commit --amend && git rebase HEAD master
@mjg123
mjg123 / latinsq.clj
Created October 26, 2011 08:37
Latin square solver in clojure
(ns latinsq.core
(:use [clojure.set :only (difference)]))
(defn replace-at
"in string s, replaces character at index p with c"
[s p c]
(str
(.substring s 0 p)
c