Skip to content

Instantly share code, notes, and snippets.

View sjl's full-sized avatar

Steve Losh sjl

View GitHub Profile
@sjl
sjl / clhs.ros
Created January 21, 2018 01:10 — forked from fukamachi/clhs.ros
A Roswell script for opening HyperSpec page describing a given symbol in the default browser.
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
A Roswell script to open the HyperSpec page of a specified symbol in the default browser.
@sjl
sjl / test.lisp
Last active October 27, 2017 21:55
(defun instrument-candles (&key
((:instrument instrument))
((:price price) "M")
((:granularity granularity) "S5")
((:count count) 500)
((:from from)
(write-to-string
(local-time:timestamp-to-unix
(local-time:timestamp- (local-time::now) 5 :minute))))
((:to to)
@sjl
sjl / gdl-kif.vim
Created January 22, 2016 10:26 — forked from muupan/gdl-kif.vim
A sintax file for Game Description Language (GDL) in Knowledge Interchange Format (KIF).
" A sintax file for Game Description Language (GDL) in Knowledge
" Interchange Format (KIF).
"
" Put this file in .vim/syntax/ and and add set filetype gdl-kif
" Example:
" au BufRead,BufNewFile *.kif set filetype=gdl-kif
syntax region gdlKifLineComment start=+;+ end=+$+
syntax match gdlKifArrow '<='
syntax keyword gdlKifFactRelation base init true next
@sjl
sjl / gist:6466546
Last active December 22, 2015 11:38 — forked from panicsteve/gist:1641705
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter

We use to stick into the SubtitleVersion.note strings such as "Rollback from version#" or "Uploaded" automatically. This was handy, because when looking at the review list, you could see that info. Helps debugging but also teams / users to grok what's going on.

However, it does have it's problems: no i18n / hard to customize messages, etc. For rollbacks,it's easy: since we already store the rollback_from_version_number, we can just check that and display that info.

I see the following alternatives: a) Stick it back into the SubtitleVersion.note field, with the issues raised above

b) Create a boolean ("from_upload") Keeps notes clean, easily 18n and customizable. However... (see bellow)

ehazlett sjl: hey have a sec?
sjl ehazlett: sure
ehazlett sjl: i'm trying to migrate the old testdata instance to the latest production
sjl ok
ehazlett sjl: when i try to migrate i'm getting the "ghost migrations" error
sjl fun
ehazlett sjl: http://d.pr/i/k7N
ehazlett sjl: sorry for the terrible formatting
sjl ehazlett: what exactly are you trying to do again?
sjl the production branch doesn't have team migrations 16+
@sjl
sjl / defrec.clj
Created September 19, 2012 16:20 — forked from cemerick/gist:3750288
defrec, rhymes with vec, because you can nth it
(defmacro defrec [name args & body]
(let [indexed-args (interleave (iterate inc 0) args)]
`(defrecord ~name ~args
clojure.lang.Indexed
(nth [_# i#]
(case i#
~@indexed-args
(throw (IndexOutOfBoundsException.))))
(nth [_# i# default#]
(case i#
@sjl
sjl / fib.js
Created May 4, 2012 00:25 — forked from ry/fib.js
(fixed) a proper fibonacci server in node. it will light up all your cores.
var http = require('http')
var fork = require('child_process').fork;
function fib(n) {
if (n < 2) {
return 1;
} else {
return fib(n - 2) + fib(n - 1);
}
}
@sjl
sjl / ui.cljs
Created February 7, 2012 15:27 — forked from srid/ui.cljs
ClojureScript - prependChild implementation using Google Closure
(defn ^:export prependChild
[parent node]
(dom/insertChildAt parent node 0))
@sjl
sjl / gist:1296686
Created October 18, 2011 20:50 — forked from aduston/gist:1296656
unisubs.streamer.StreamBox.prototype.transcriptScrolled_ = function(e) {
if (this.videoScrolling_) {
this.videoScrolling_ = false;
} else {
this.showResyncButton_(true);
this.ignoreVideoScrolling_ = true;
}
};
unisubs.streamer.StreamBox.prototype.scrollIntoView_ = function(streamSub) {