I hereby claim:
- I am coreyward on github.
- I am coreyward (https://keybase.io/coreyward) on keybase.
- I have a public key whose fingerprint is 588A B309 8DE7 3379 60A5 6BE5 8095 E17F 15D4 EE89
To claim this, I am signing this object:
$('div,p,section,header,footer,ul,ol,li').each(function(){ | |
var h, el, baseline; | |
el = $(this); | |
height = el.outerHeight(); | |
baseline = 13; | |
if (Math.round(height) % baseline > 0) { | |
el.addClass('boink'); | |
console.log( height, this ); |
# Non-Blocking iFrames | |
$ -> | |
$('iframe[data-src]').each -> | |
this.setAttribute 'src', this.getAttribute 'data-src' |
# only bind if/when GA loads | |
ga -> | |
$('a[href*="//"]').click (e) -> | |
e.preventDefault() | |
url = $(this).attr('href') | |
# define the callback | |
action = -> document.location = url | |
# record the click as an event |
I hereby claim:
To claim this, I am signing this object:
Usage: | |
ruby mysql_backup.rb db:name [user:your_username] \ | |
[password:your_password] \ | |
[host:your_hostname] \ | |
[file:output_file.sql] | |
Feel free to use, improve, etc. I'm new to Ruby, so excuse anything that makes your palm slap your forehead. ;) |
# Via http://blog.ethanvizitei.com/2008/06/using-ruby-for-imap-with-gmail.html | |
imap = Net::IMAP.new(@config['server'],@config['port'],true) | |
imap.login(@config['username'], @config['password']) | |
imap.select('INBOX') | |
imap.search(["NOT", "DELETED"]).each do |message_id| | |
MailFetcher.receive(imap.fetch(message_id, "RFC822")[0].attr["RFC822"]) | |
imap.store(message_id, "+FLAGS", [:Deleted]) | |
end | |
imap.logout() |
class Range | |
def pick | |
if min.is_a? Fixnum | |
rand(count) + min | |
else | |
self.to_a[rand(count)] | |
end | |
end | |
alias :random :pick | |
end |
require 'benchmark' | |
n = 100000 | |
a = %w{ 1 2 3 4 5 6 7 8 9 0 } | |
Benchmark.bmbm do |b| | |
b.report 'Explicit Block' do | |
n.times do | |
a.map { |x| x.to_i } | |
end |
require 'rubygems' | |
require 'cloudfiles' | |
class Hash | |
def reverse_merge(other_hash) | |
other_hash.merge(self) | |
end | |
end | |
class Cloud |
# because I always forget the magic sequence of commands… | |
ssh host 'git init --bare /var/src/repo.git' | |
git remote add mirror --mirror host/var/src/repo.git | |
git push mirror # tada |