Skip to content

Instantly share code, notes, and snippets.

View sbrauer's full-sized avatar

Sam Brauer sbrauer

  • Durham, NC, USA
View GitHub Profile
@sbrauer
sbrauer / gist:aaf6946d0aa678e20b13
Created June 9, 2014 15:24
Msg proxy sequence diagram source
note over data: receive new lead
note over t_addresses,t_messages
(this note is here to position these entities)
end note
data->msg_proxy: send request to msg_proxy
note over data
* lead ID
* landlord name & address
* renter name & address
end note
@sbrauer
sbrauer / gitcommit
Created April 23, 2014 19:00
gitcommit
#!/usr/bin/env ruby
# A wrapper around "git commit" that provides a template message
# conforming to RentPath conventions.
# by Sam Brauer 2013-09-05
# inspired by Zander Hill's vim macro (https://gist.github.com/anonymous/b6cf9e57c9bb26cf3f3f)
# Assumes branches are named with the following components separated
# by underscores:
# 1. developer initials (one or more of these components are allowed)
# 2. story number
# 3. free text description (optional; may contain underscores)
@sbrauer
sbrauer / gist:10476028
Last active August 29, 2015 13:59
Flex price range widget
similar to zillow
one UI "dropdown" that shows the current range:
"Any price" (when neither set)
"$800-$1000" (when both set)
"$800+" (min only)
"Up to $1000" (max only)
When dropped down, has two text fields for min and max.
Puts focus in min field.
@sbrauer
sbrauer / routes.rb
Last active August 29, 2015 13:56
DNI Demo
# Add to ag/app/routes/routes.rb
get '/dni_demo/' do
zid = request.cookies['zid']
msg = zid ? "Your zid is #{zid}" : "You have no zid"
content_type 'text/javascript'
%{document.getElementsByTagName('span')[0].textContent = "#{msg}";}
end
@sbrauer
sbrauer / sinatra_render_spy.rb
Created December 19, 2013 14:40
Notes parameters to most recent call to Sinatra::Template.render and exposes them via #last_render.
require 'sinatra'
module Sinatra
module Templates
@@last_render = {}
alias_method :orig_render, :render
def render(engine, data, options={}, locals={}, &block)
@@last_render[:engine] = engine
@@last_render[:data] = data
@sbrauer
sbrauer / gitcommit
Last active December 22, 2015 09:49
git commit wrapper script
#!/usr/bin/env ruby
# A wrapper around "git commit" that provides a template message
# conforming to RentPath conventions.
# Assumes branches are named with the following components separated
# by underscores:
# 1. developer initials (one or more of these components are allowed)
# 2. story number
# 3. free text description (optional; may contain underscores)
# Examples:
# "sb_12345_fix_serious_bug"
@sbrauer
sbrauer / gist:1478233
Created December 14, 2011 20:05
trying to use standard_html_strip in ElasticSearch
$ curl -XPUT http://localhost:9200/foo
{"ok":true,"acknowledged":true}
$ curl -XPUT http://localhost:9200/foo/bar/_mapping -d '{
"properties" : {
"body": {"type":"string", "analyzer":"standard_html_strip"}
}
}'