Skip to content

Instantly share code, notes, and snippets.

J. Whiteman jwhiteman

Block or report user

Report or block jwhiteman

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
jwhiteman / gist:3625a7479082e245bf71
Created May 15, 2014
Trolling twitter for 2-letter handles
View gist:3625a7479082e245bf71
require 'httparty'
include HTTParty
('aa'..'zz').select { |r|
sleep 0.20
puts "trying #{r}"
self.class.head("{r}").code == 404
# => ['me', 'oh']
jwhiteman / gist:079fe77fc626d49c9f8a
Created Jul 18, 2014
immutable means immutable
View gist:079fe77fc626d49c9f8a
Gotcha with Erlang
v-kserl-v-02-code erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V5.10.4 (abort with ^G)
1> VALUE = fun() -> io:format("I have value!~n") end.
2> K = mykey.
View gist:d254a05e82a04a64c1ff
Y = fun(C) ->
(fun(H) ->
fun(F) ->
C(fun(X) -> (F(F))(X) end)
View gist:34d447a0d249d2e29035
(define y2
(lambda (c)
((lambda (h)
(h h))
(lambda (f)
(c (lambda (x y)
((f f) x y)))))))
(define make-rember
(y2 (lambda (f)
View gist:139ce4b5267fcc29b2ef
def daemonize_app
if RUBY_VERSION < "1.9"
exit if fork # jettison the terminal
Process.setsid # establish a new group & session leader (can only be done as a child process)
exit if fork # jettison the group leader. now it can't be interrupted from another group or session going down.
Dir.chdir "/" # change dir to root to make sure that the dir won't go away during the process run
# as a demon we won't be needing these...
STDIN.reopen "/dev/null"
STDOUT.reopen "/dev/null", 'a'
jwhiteman / ch10-ex6.ex
Last active Aug 29, 2015
#flatten in Elixir
View ch10-ex6.ex
defmodule MyList do
# version 1: continuation passing style
def flatten(l), do: flatten(l, fn (result) -> result end)
def flatten([], col), do: col.([])
def flatten([h|t], col) when not is_list(h) do
flatten(t, fn (acc) -> col.([h | acc]) end)
def flatten([h|t], col) do
View list_parser.yrl
% Andrea Leopardi's list parser
Nonterminals list elems elem.
Terminals '[' ']' ',' int atom.
Rootsymbol list.
list ->
'[' ']' : [].
list ->
View ring.exs
defmodule Ring do
def node(name, next_pid) do
receive do
1 ->
send next_pid, 1
n when is_number(n) ->
send next_pid, n
node(name, next_pid)
jwhiteman / basics-with-letrec.scm
Last active Aug 29, 2015
map & fold explorations
View basics-with-letrec.scm
;; letrec practice
;; fold
;; map
;; filter
;; mapcat
(define (fold fold-f acc l)
((FOLD (lambda (acc l)
jwhiteman / gist:4229ed6ecdea3ea71be8
Last active Aug 29, 2015 — forked from fnando/gist:de555a08e7aab14a661a
Exporting PDF with DocRaptor
View gist:4229ed6ecdea3ea71be8
curl -H "Content-Type:application/json" -d'{"user_credentials":"YOUR_CREDENTIALS_HERE", "doc":{"name":"kitabu.pdf", "document_type":"pdf", "test":"false", "document_url":""}}' > kitabu.pdf
You can’t perform that action at this time.