Skip to content

Instantly share code, notes, and snippets.

context 'with sintatra helpers' do
let(:template) { Tilt::MustacheTemplate.new { |t| 'Hello {{ name.hello }}!'} }
let(:scope) do
scope = Object.new
def scope.name name
{"hello" => 'Moto!'}
end
scope
end
helpers Sinatra::AssetHelpers
mustache_view_helpers Sinatra::AssetHelpers
"&&ERROR&&["here", "comes", "the", "data"]"
@beatrichartz
beatrichartz / gist:5968572
Last active December 19, 2015 14:19
Picky Bug Report
require 'picky'
Shoe = Struct.new(:id, :color, :name)
shoes_index = Picky::Index.new(:shoes) do
category :color
category :name
end
shoes_search = Picky::Search.new(shoes_index)
func main() {
m = martini.Classic()
s = subrouter.Extend(m) // returns subrouter.Router or similar
// possible additional uses: Subdomains, Methods etc
// s.Subdomain("admin")
// subrouter extends martini with more routing patterns
Hash.new{|h,k| h[k] = Hash.new(&h.default_proc) }
@beatrichartz
beatrichartz / cap_test.go
Created February 25, 2015 15:14
Difference for capacity
package captest
import "testing"
func WithCap() {
sl := make([]int, 500, 1000)
for i := 0; i < 1000; i++ {
if i < 500 {
sl[i] = i
} else {
alias newpassword='</dev/urandom gtr -dc "0-9a-zA-Z\-_.,:;!?@$%&*(){}[]#|<>" | head -c $(gshuf -i 32-64 -n 1); echo ""'

Keybase proof

I hereby claim:

  • I am beatrichartz on github.
  • I am beatrichartz (https://keybase.io/beatrichartz) on keybase.
  • I have a public key ASDnfHzijyPl2VnNDJrmAjvZ3UqjGzx-UTxP_uXiokUgiQo

To claim this, I am signing this object:

Mon Jan 7 03:25:40 UTC 2019