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
// See: http://ejohn.org/blog/learning-from-twitter/ | |
(function($) { | |
$(document).ready(function() { | |
var resizeCallable = function() { | |
switch (true) | |
{ | |
case (window.innerWidth <= 768): | |
// Do some exciting device size specific magic here. | |
break; | |
} |
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
<?php | |
// See: https://gist.github.com/1942528 | |
trait Call_Dynamic_Methods | |
{ | |
public function __call($name, $arguments) | |
{ | |
if (isset($this->{$name}) && $this->{$name} instanceof Closure) { | |
$this->{$name} = $this->{$name}->bindTo($this, $this); | |
return call_user_func_array($this->{$name}, $arguments); | |
} |
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
#!/usr/bin/env python | |
import optparse, random, sys | |
def main(): | |
parser = optparse.OptionParser() | |
parser.add_option('--min', type="int", default=0, help="The minimum number limit.") | |
parser.add_option('--max', type="int", default=100, help="The maximum number limit.") | |
opts, args = parser.parse_args() | |
tries = 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
# config/config.yml | |
defaults: &defaults | |
key: value | |
regexp: !ruby/regexp /pattern/ | |
development: | |
<<: *defaults | |
test: |
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
module ApplicationHelper | |
def build_page_title(*crumbs) | |
crumbs.map(&:to_s).reject(&:empty?).join(' - ') | |
end | |
end |
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
// Ensure iOS Safari fullscreen links don't open in external Safari. | |
$(document).ready(function() { | |
if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) { | |
$('a').each(function() { | |
$(this).attr('href', 'javascript:window.location = "' + $(this).attr('href') + '"'); | |
}); | |
} | |
}); |
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
# See: http://ubuntuforums.org/showthread.php?t=261366 | |
# Make list of installed software. | |
dpkg --get-selections > installed-software | |
# Install software on another machine. | |
dpkg --set-selections < installed-software | |
sudo apt-get install dselect | |
dselect |
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
# Clear Ubuntu image network rules before cloning. | |
sudo rm /etc/udev/rules.d/70-persistent-net.rules | |
# Clone a VirtualBox disk image. | |
VBoxManage clonehd /path/to/original.vdi /path/to/clone.vdi |
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
# /path/to/repository/.hg/hgrc | |
# $ hg push staging | |
# $ hg push live | |
[paths] | |
live = ssh://<username>@<server>//var/www/vhosts/<live-website> | |
staging = ssh://<username>@<server>//var/www/vhosts/<staging-website> | |
[hooks] | |
changegroup = hg update |
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
# Install XCode. | |
# Install XCode CLI Tools. | |
# Select XCode. | |
xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
# Install Auto Tools. | |
brew install autoconf automake | |
# Symlink iOS Simulator. |