Skip to content

Instantly share code, notes, and snippets.

server {
listen 80;
server_name *.dev;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://localhost:3000;
}
// I want to run few operations that may fail, and in case of failure run
// corresponding rollback function
val f: A => Either[Success, Error]
val fBack: A => Unit
val g: B => Either[Success, Error]
val gBack: B => Unit
val h: A => B => Either[Success, Error] = ?
module VagrantPlugins
module ProviderVirtualBox
module Action
class SnapshotList
def initialize(app, env)
@app = app
end
def call(env)
puts "Listing snapshots for '#{env[:machine].name}':"
@teamon
teamon / log
Last active December 14, 2015 12:09
⌘ ~/t/scratch-1362338550 [puppet ✘] >> ruby p.rb
/Users/teamon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/puppet-3.1.0/lib/puppet/settings.rb:285:in `block in convert': Error converting value for param 'statedir': Could not find value for $vardir (Puppet::Settings::InterpolationError)
from /Users/teamon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/puppet-3.1.0/lib/puppet/settings.rb:276:in `gsub'
from /Users/teamon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/puppet-3.1.0/lib/puppet/settings.rb:276:in `convert'
from /Users/teamon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/puppet-3.1.0/lib/puppet/settings.rb:986:in `value'
from /Users/teamon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/puppet-3.1.0/lib/puppet/settings.rb:97:in `[]'
from /Users/teamon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/puppet-3.1.0/lib/puppet.rb:64:in `[]'
from /Users/teamon/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/puppet-3.1.0/lib/puppet/util/storage.rb:46:in `load'
fr
@teamon
teamon / ruby-1.9.3-vs-2.0.0-vs-rbx-head.txt
Last active December 14, 2015 11:29
ruby 1.9.3 vs 2.0.0 vs rbx (rails env loading)
>> time rails runner "puts 1"
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.2]
22.35 real 18.03 user 2.80 sys
19.59 real 17.33 user 2.18 sys
18.62 real 16.53 user 2.02 sys
18.81 real 16.61 user 2.14 sys
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]
@teamon
teamon / git-make
Last active December 13, 2015 23:59
#!/usr/bin/env ruby
def sh(cmd)
puts "[sh] #{cmd}"
raise "git error" unless system(cmd)
end
if ARGV.size < 3 || ARGV[1] != "of"
puts "Example usage: git make staging of dev feature/foo feature/bar"
else
@teamon
teamon / redis.hs
Last active December 12, 2015 02:28
{-# LANGUAGE OverloadedStrings #-}
import Database.Redis hiding (decode)
import Text.JSON
import Data.ByteString.Char8 (unpack)
import Control.Arrow (left)
import Data.Traversable (traverse)
getValueFromJSON json = decode json >>= valFromObj "value" :: Result (Float)
- fun f g a b = g a b;
val f = fn : ('a -> 'b -> 'c) -> 'a -> 'b -> 'c
- fun plus a b = a + b;
val plus = fn : int -> int -> int
- fun mul a b = a * b;
val mul = fn : int -> int -> int
- f plus 2 3;
val it = 5 : int
- f mul 2 3;
val it = 6 : int
- fun f a b c = a+b+c;
val f = fn : int -> int -> int -> int
- f 1;
val it = fn : int -> int -> int
- f 1 2;
val it = fn : int -> int
- f 1 2 3;
val it = 6 : int
- val g = f 1;
val g = fn : int -> int -> int
/*
Source code is in UTF-8 encoding. The following symbols may appear, among others:
α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ ς σ τ υ φ χ ψ ω « • ¦ » fi fl ƒ
If you can't read this, you're out of luck.
This code was generated with the frege compiler version 3.19.112 from hello.hs
Do not edit this file! Instead, edit the source file and recompile.
*/
import frege.MD;