Skip to content

Instantly share code, notes, and snippets.

View danschultzer's full-sized avatar
I may be slow to respond.

Dan Schultzer danschultzer

I may be slow to respond.
View GitHub Profile
danschultzer / generator.ex
Created February 7, 2018 06:14
Random alphanumeric id generator in elixir
defmodule Generator
def gen_reference() do
min = String.to_integer("100000", 36)
max = String.to_integer("ZZZZZZ", 36)
|> Kernel.-(min)
|> :rand.uniform()
|> Kernel.+(min)
|> Integer.to_string(36)
danschultzer / code_of_advent_day_1.exs
Last active December 2, 2017 23:05
Code of Advent 2017 Elixir
# Part one
defmodule CodeAdvent_1 do
def sum(captcha, acc) when is_integer(captcha) do
digits = Integer.digits(captcha)
first_digit = List.first(digits)
|> Kernel.++([first_digit])
|> sum(acc)
### Keybase proof
I hereby claim:
* I am danschultzer on github.
* I am danschultzer ( on keybase.
* I have a public key whose fingerprint is BCD8 3343 783D 89B2 182C E607 DE85 6784 DA1D B10B
To claim this, I am signing this object:
body {
font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;
.color_js_button {
padding: 8px 12px;
border-radius: 4px;
margin-right: 4px;
box-shadow: rgba(0, 0, 0, 0.2) 0px 2px 5px;
danschultzer / gist:5277605
Last active December 15, 2015 14:49
This is a method to do non-blocking lazy loading of javascript, preventing your page to look "loading slow" due to external loads.
var scrs=d.getElementsByTagName("script");
var scr=scrs[scrs.length-1];
var w=window;
function n(){
var e=d.createElement("script");