This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table { display: table } | |
tr { display: table-row } | |
thead { display: table-header-group } | |
tbody { display: table-row-group } | |
tfoot { display: table-footer-group } | |
col { display: table-column } | |
colgroup { display: table-column-group } | |
td, th { display: table-cell } | |
caption { display: table-caption } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.element { | |
position: relative; | |
top: 50%; | |
transform: translateY(-50%); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All elements which match this will be syntax highlighted. | |
var selector = 'code'; | |
var keywords = ('var function if else for while break switch case do new ' | |
+'continue delete return this true false throw catch typeof').split(' '); | |
// Syntax definition | |
// The key becomes the class name of the <span> | |
// around the matched block of code. | |
var syntax = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Asynchronous DSL for CoffeeScript | |
serial = (f) -> | |
next = -> arr.shift().apply(null, arguments) if arr.length | |
arr = (v for k, v of f(next)) | |
next() | |
null | |
parallel = (f, after = ->) -> | |
res = {}; arrc = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add this script to the end of your document that use <input autofocus type="text" /> | |
* or <input type="text" placeholder="username" /> and it'll plug support for browser | |
* without these attributes | |
* Minified version at the bottom | |
*/ | |
(function () { | |
function each(list, fn) { | |
var l = list.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is how you can get a user's location using MacRuby and CoreLocation | |
framework 'CoreLocation' | |
def locationManager(manager, didUpdateToLocation: new_location, fromLocation: old_location) | |
puts "location: #{new_location.description}" | |
exit | |
end | |
loc = CLLocationManager.alloc.init | |
loc.delegate = self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DateHelper = { | |
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time | |
// Ruby strftime: %b %d, %Y %H:%M:%S GMT | |
time_ago_in_words_with_parsing: function(from) { | |
var date = new Date; | |
date.setTime(Date.parse(from)); | |
return this.time_ago_in_words(date); | |
}, | |
time_ago_in_words: function(from) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Monitor HTTP requests being made from your machine with a one-liner.. | |
# Replace "en1" below with your network interface's name (usually en0 or en1) | |
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*" | |
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile: | |
# (again replace "en1" with correct network interface name) | |
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"" | |
# All the above tested only on OS X. |