Skip to content

Instantly share code, notes, and snippets.

View wlangstroth's full-sized avatar

Will Langstroth wlangstroth

View GitHub Profile
@wlangstroth
wlangstroth / deploy.rb
Last active September 11, 2021 13:15
Capistrano + Nginx + Unicorn + Sinatra on Ubuntu
require 'bundler/capistrano'
set :application, "net"
set :repository, "git@githost.com:net.git"
set :scm, :git
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
@wlangstroth
wlangstroth / slim-html5-boilerplate
Created July 11, 2012 15:05 — forked from blakehilscher/slim-html5-boilerplate
Slim HTML5 Boilerplate Rails
doctype html
/[if lt IE 7]
html.no-js.lt-ie9.lt-ie8.lt-ie7 lang="en"
/[if IE 7]
html.no-js.lt-ie9.lt-ie8 lang="en"
/[if IE 8]
html.no-js.lt-ie9 lang="en"
| <!--[if (gte IE 8)]<!-->
<html class="no-js" lang="en"> <!--<![endif]-->
head
@wlangstroth
wlangstroth / index.html.slim
Last active August 2, 2016 01:51
html5boilerplate in slim
doctype html
/[if lt IE 7]
html.no-js.lt-ie9.lt-ie8.lt-ie7 lang="en"
/[if IE 7]
html.no-js.lt-ie9.lt-ie8 lang="en"
/[if IE 8]
html.no-js.lt-ie9 lang="en"
| <!--[if (gte IE 8)]<!-->
<html class="no-js"> <!--<![endif]-->
head
localStorage.setItem(key, value);
localStorage.getItem(key);
localStorage.removeItem(key);
localStorage.clear();
@wlangstroth
wlangstroth / fizz.rb
Created March 29, 2011 02:52
still ugly, but I like it better
#!/usr/bin/env ruby
(1..100).each do |n|
out = ""
if n.modulo(3) == 0
out += "Fizz"
end
if n.modulo(5) == 0
out += "Buzz"
end
@wlangstroth
wlangstroth / failbuzz.js
Created March 28, 2011 19:24
Oh the humanity.
for (var i = 1; i <= 100; i++) {
if (i % 3 == 0 && i % 5 == 0) {
print "FizzBuzz";
} else if (i % 3 == 0) {
print "Fizz";
} else if (i % 5 == 0) {
print "Buzz";
} else {
print i;
}
prod = reduce(operator.mul, [1,2,3], 1)
prod = foldl (*) 1 [1,2,3]
prod = 1
for i in [1,2,3]:
prod *= i
import System.Random
randPairs :: (RandomGen g, Random a) => (a,a) -> g -> [(a,a)]
randPairs range gen = zip as bs
where (a,b) = split gen -- create two separate generators
as = randomRs range a -- one infinite list of randoms
bs = randomRs range b -- another
seed = 13561956 :: Int
mygen = mkStdGen seed