- Latest Safari (6.0), Chrome and Firefox
- IE9
- Chrome (latest)
- Firefox (latest)
- Safari 5.1
Number::m = (seconds = 0) -> | |
this * 60 + seconds | |
markers = [ | |
0.m 36 | |
1.m 14 | |
1.m 48 | |
2.m 23 | |
2.m 56 | |
3.m 30 |
#!/usr/bin/env ruby | |
command = ARGV.join(' ') | |
begin | |
env = File.read("#{Dir.pwd}/.env") | |
lines = env.strip.split("\n").reject{ |line| !line.match(/^\w+=/) } | |
variables = lines.join(' ') | |
exec "#{variables} #{command}" |
head, meta[name="description"], meta[property^="og:"] { display: block } | |
head { | |
position: relative; | |
z-index: 9999; | |
font: 21px/1.4 Didot; | |
color: #444; | |
-webkit-hyphens: auto; | |
padding: 2em; | |
background: #fff; | |
-webkit-font-smoothing: subpixel-antialiased; |
In most browsers, event
is an ever-existing JavaScript variable which value changes depending on context.
Safari, Chrome and Opera:
<script>
window.onload = function() {
console.log(event) // Event (type: "load")
}
console.log(event) // undefined
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
error = `coffee -c #{ENV['TM_FILEPATH']} 2>&1` | |
if error == '' | |
puts "✔ compiled #{ENV['TM_FILEPATH'].sub(/\.coffee$/, '.js')}" | |
else | |
puts "❗#{error}" | |
end |
<style> | |
div { | |
width: 0; height: 0; | |
border-style: solid; | |
margin: 20px; | |
} | |
div:nth-child(odd) { border-width: 32px } /* edges */ | |
div:nth-child(even) { border-width: 24px } /* corners */ | |
.top { border-color: red transparent transparent transparent } |
# Methods ending in “=” that accept a single argument will treat multiple arguments as an array. | |
class Foo | |
def types=(array) | |
p array | |
end | |
end | |
foo = Foo.new | |
foo.types = [:bar, :baz, :quux] # => [:bar, :baz, :quux] |
I am overriding the external_url=
setter to ensure URLs start with http://
. I’m doing this before any validation because I don’t want to bother the user who enters example.com/foo/bar
without http://
. I don’t plan on validating the URL at all anyway.
def external_url=(url)
if !url.match /^https?:\/\//i
url = "http://#{url}"