Skip to content

Instantly share code, notes, and snippets.

@daz
daz / html5.haml
Created November 11, 2011 08:43
html5shiv in HAML
!!!
%html{ :lang => "en" }
%head
%meta{ :charset => "utf-8" }
%title HTML5 yo
/[if lt IE 9]
%script{ :src => '//html5shiv.googlecode.com/svn/trunk/html5.js' }
@daz
daz / edit.html.erb
Created February 22, 2012 09:13
twitter-bootstrap-rails ERB template
<%= render :partial => 'form' %>
@daz
daz / style.scss
Last active May 13, 2023 11:24 — forked from kevindavis/gist:1868651
Bootstrap styling for jQuery UI autocomplete
.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
@daz
daz / gist:3095875
Created July 12, 2012 04:50
Nice web type
@daz
daz / _menu.html.erb
Created September 4, 2012 05:14
Bootstrap dropdown menu with Rails and Ancestry
<% if article.is_childless? %>
<li><%= link_to article.title, article_path(article) %></li>
<% else %>
<li class="dropdown">
<%= link_to '#', class: 'dropdown-toggle', data: { toggle: 'dropdown'} do %>
<%= article.title %>
<b class="caret"></b>
<% end %>
<ul class="dropdown-menu">
<%= render partial: 'site/menu', collection: article.children, as: :article %>
@daz
daz / appleevent.rb
Created September 13, 2012 04:09
Watch for Apple event video posting
#!/usr/bin/ruby
# encoding: utf-8
# Pings Apple events page until the video is posted
# Videos are usually live ~6 hours after official start time
#
# $ git clone https://gist.github.com/3711799.git appleevent
# $ ruby appleevent/appleevent.rb
require 'date'
@daz
daz / gist:3713077
Created September 13, 2012 09:07
Get up and going in Rails
# install textmate
https://github.com/textmate/textmate/downloads
# install command line tools for mountain lion
# need this for homebrew apparently
https://developer.apple.com/downloads/index.action
# change shell to zsh
# has better tab completion and makes terminal easier
chsh -s /bin/zsh
class Employee
PAY_RATES = [1, 6, 7.80]
def pay_rate
case age
when 0..15
PAY_RATE[0]
when 15..16
PAY_RATE[1]
@daz
daz / gist:3742040
Last active September 23, 2016 08:30
Apple Maps redirects to Google Maps
$ curl --trace-ascii /dev/stdout 'http://maps.apple.com/?lsp=9902&sll=47.606209,-122.332071&q=Seattle%20WA' | pbcopy
== Info: Trying 23.215.221.249...
== Info: Connected to maps.apple.com (23.215.221.249) port 80 (#0)
=> Send header, 128 bytes (0x80)
0000: GET /?lsp=9902&sll=47.606209,-122.332071&q=Seattle%20WA HTTP/1.1
0042: Host: maps.apple.com
0058: User-Agent: curl/7.49.1
0071: Accept: */*
007e:
@daz
daz / gist:4959756
Last active December 13, 2015 18:59 — forked from ash37/gist:4959753
def display_address_title(employee)
if employee.address.empty?
''
else
'<b>Address</b>'
end
end