Skip to content

Instantly share code, notes, and snippets.

View dan's full-sized avatar
🕶️
Seeking restitution for my ruined rug.

Dan Benjamin dan

🕶️
Seeking restitution for my ruined rug.
View GitHub Profile
@dan
dan / foo.js
Created February 29, 2012 19:31
$(document).ready(function() {
$('#open_new_window').change(function() {
if ($(this).attr('checked')) {
$('a.link').attr("target", '_blank');
} else {
$('a.link').attr("target", "");
}
});
});
@dan
dan / hack.sh
Created March 31, 2012 12:17 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@dan
dan / dantimer.rb
Created June 22, 2012 13:31 — forked from davetron5000/dantimer.rb
DanTimer
#!/usr/bin/ruby
require 'time'
def format_time(seconds)
hours = (seconds / 3600).to_i
minutes = ((seconds % 3600) / 60).to_i
seconds = (seconds % 60).to_i
minutes = "0#{minutes}" if minutes < 10
seconds = "0#{seconds}" if seconds < 10
@dan
dan / UITextView.c
Last active December 18, 2015 17:29 — forked from brentsimmons/gist:5810992
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1)
return NO;
@dan
dan / gist:8648012
Created January 27, 2014 12:51
Homebrew MySQL Mac OS X Start
brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
@dan
dan / datatables_angry.rb
Last active August 29, 2015 13:55
DataTables doesn't work with Rails 4 and Ruby 2.
# UPDATE: This is working now, thanks to @mamaduka:
# In home.js.coffee I had "bjQueryUI" instead of "bJQueryUI" ... D'oh!

Keybase proof

I hereby claim:

  • I am dan on github.
  • I am danbenjamin (https://keybase.io/danbenjamin) on keybase.
  • I have a public key whose fingerprint is 3AB5 BD4B 523F E697 68BA 2022 0A86 5D59 34EE 7E86

To claim this, I am signing this object:

require 'paperclip/media_type_spoof_detector'
module Paperclip
class MediaTypeSpoofDetector
def spoofed?
false
end
end
end
<itunes:category text="Society &amp; Culture">
<itunes:category text="History" />
</itunes:category>
<itunes:category text="Technology">
<itunes:category text="Gadgets" />
</itunes:category>
require 'mp3info'
# some test data, replace it with your own data
title = "After Dark #388: After Back to Work"
subtitle = "Merlin & Dan talk after Back to Work episode 104."
artist = "Dan Benjamin on 5by5.tv"
album = "After Dark"
genre = "Podcast"
track = 338
year = 2013