Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Losh sjl

View GitHub Profile
@sjl
sjl / clhs.ros
Created Jan 21, 2018 — forked from fukamachi/clhs.ros
A Roswell script for opening HyperSpec page describing a given symbol in the default browser.
View clhs.ros
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
#|
A Roswell script to open the HyperSpec page of a specified symbol in the default browser.
View test.lisp
(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 Jan 22, 2016 — forked from muupan/gdl-kif.vim
A sintax file for Game Description Language (GDL) in Knowledge Interchange Format (KIF).
View gdl-kif.vim
" 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
View gist:6466546
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
View gist:4986914

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)

View gist:4438002
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 Sep 19, 2012 — forked from cemerick/gist:3750288
defrec, rhymes with vec, because you can nth it
View defrec.clj
(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 — forked from ry/fib.js
(fixed) a proper fibonacci server in node. it will light up all your cores.
View fib.js
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 Feb 7, 2012 — forked from srid/ui.cljs
ClojureScript - prependChild implementation using Google Closure
View ui.cljs
(defn ^:export prependChild
[parent node]
(dom/insertChildAt parent node 0))
View gist:1296686
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) {