Skip to content

Instantly share code, notes, and snippets.

Avatar

Jamie York ziadoz

View GitHub Profile
@ziadoz
ziadoz / example.js
Created Feb 23, 2012 — forked from anonymous/example.js
JQuery Resize Events
View example.js
// 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;
}
@ziadoz
ziadoz / meta.php
Created Feb 29, 2012 — forked from funkatron/foo.php
PHP 5.4 Meta Programming?
View meta.php
<?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);
}
@ziadoz
ziadoz / number.py
Created Mar 23, 2012
Python CLI Skeleton
View number.py
#!/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
@ziadoz
ziadoz / config.yml
Created Jun 18, 2012
Rails 3 YAML Configuration Loader
View config.yml
# config/config.yml
defaults: &defaults
key: value
regexp: !ruby/regexp /pattern/
development:
<<: *defaults
test:
@ziadoz
ziadoz / application_helper.rb
Created Jun 18, 2012
Rails 3 Page Title Breadcrumb
View application_helper.rb
module ApplicationHelper
def build_page_title(*crumbs)
crumbs.map(&:to_s).reject(&:empty?).join(' - ')
end
end
@ziadoz
ziadoz / jquery-ios-safari-fullscreen-links.js
Created Jul 9, 2012
jQuery iOS Safari Fullscreen Links
View jquery-ios-safari-fullscreen-links.js
@ziadoz
ziadoz / dpkg.sh
Last active Oct 7, 2015
Create List of Installed Packages (Ubuntu/Debian)
View dpkg.sh
# 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
@ziadoz
ziadoz / gist:3124039
Created Jul 16, 2012
Clone VirtualBox Image
View gist:3124039
# 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
@ziadoz
ziadoz / hgrc
Created Jul 16, 2012
Mercurial Remote Deployment
View hgrc
# /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
@ziadoz
ziadoz / gist:3130725
Created Jul 17, 2012
Setup XCode, CLI Tools and HomeBrew
View gist:3130725
# 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.