Skip to content

Instantly share code, notes, and snippets.

def browser_scoped_container(el='body', options={}, &block)
namespace = 'browser_'
html = "<!--[if lt IE 7 ]><#{el} #{tag_options(options.merge(:class => "#{namespace}ie6"))}><![endif]-->"
html += "<!--[if IE 7 ]><#{el} #{tag_options(options.merge(:class => "#{namespace}ie7"))}><![endif]-->"
html += "<!--[if IE 8 ]><#{el} #{tag_options(options.merge(:class => "#{namespace}ie8"))}><![endif]-->"
html += "<!--[if (gt IE 9)|!(IE)]><!--><#{el} #{tag_options(options.merge(:class => "#{namespace}non_ie"))}><!--<![endif]-->"
html += capture(&block)
html += "</#{el}>"
html
@alexwelch
alexwelch / jquery slideshow
Created November 23, 2010 16:58
a very simple jquery slideshow plugin
(function($){
$.slideshow = function(el, options){
var base = this;
base.$el = $(el);
base.el = el;
base.slide = -1;
base.timer = false;
// Add a reverse reference to the DOM object
@alexwelch
alexwelch / locationSuggest
Created December 1, 2010 22:25
suggests your city and state based on the zip code
// requires google maps api: "http://maps.google.com/maps/api/js?sensor=false"
// and of course jQuery
(function($){
$.locationSuggest = function(el, options){
var base = this;
base.$el = $(el);
base.el = el;
@alexwelch
alexwelch / speeding_roi.rb
Created March 14, 2015 04:30
ROI given time savings and annual speeding ticket cost.
annual_miles_driven = 10_000 #miles
average_speed_limit = 50 #mph
your_average_speed = 60 #mph
annual_citation_spend = 800 #dollars
time_saved = (annual_miles_driven / average_speed_limit) - (annual_miles_driven / your_average_speed)
puts "Your time better be worth more than: $#{annual_citation_spend / time_saved}/hour"
---
adapter:
command: rackup
environment:
- "FLEETCTL_ENDPOINT=http://172.17.42.1:4001"
ports:
- "9292:9292"
agent:
build: /var/panamax-remote-agent
@alexwelch
alexwelch / hashes.rb
Last active April 5, 2016 02:32 — forked from devoracer/hashes.rb
tests
require File.expand_path(File.dirname(__FILE__) + '/neo')
class AboutHashes < Neo::Koan
def test_creating_hashes
empty_hash = Hash.new
assert_equal Hash, empty_hash.class
assert_equal({}, empty_hash)
assert_equal 0, empty_hash.size
end