Skip to content

Instantly share code, notes, and snippets.

View bluefuton's full-sized avatar

Chris R bluefuton

View GitHub Profile
config.action_controller.asset_host = Proc.new do |source, request|
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com"
ssl_host = "https://asset1.backpackit.com"
if request.ssl?
case
when source =~ /\.js$/
ssl_host
when request.headers["USER_AGENT"] =~ /(Safari)/
non_ssl_host
@brendo
brendo / README
Created September 10, 2009 00:32
Inline Validation for Symphony
------------------------------
@version 1.0
@release 10th September 2009
@jquery 1.3.2
Allows you attach inline Ajax validation to your forms.
The validation appears on inputs and textareas after the user
has filled them out (why validate on nothing..). The error
<?php
/*
* Postcode validation function
* Based on code by John Gardner: http://www.braemoor.co.uk/software/postcodes.shtml
* Converted to use PCRE rather than the now deprecated POSIX regular expressions by
* David Evans.
*
* Optional second argument is set to the properly capitalised and spaced version of
* the postcode.
@benpickles
benpickles / minify
Created January 4, 2011 21:17
Swiftly concat and minify JavaScript files from the command line
#!/usr/bin/env ruby
dry_run = ARGV.delete('--dry-run')
force = ARGV.delete('--force')
if ARGV.empty?
puts <<-USAGE
minify, swiftly concat and minify JavaScript files from the command line
Pass a single argument to create a .min.js version:
@naholyr
naholyr / svn-branch.sh
Created February 1, 2012 15:51
Branching with SVN
# Retrieve repository URL
function svn-url() {
LANG=en_US svn info "$1" | grep '^URL *:' | sed 's/^URL *: //'
}
# Branching
function svn-branch() {
if [ ! -d .svn ]; then return 1; fi
if svn-url | grep '/trunk' &> /dev/null; then
echo trunk
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/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
#
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@thealscott
thealscott / jquery.autolink.js
Created May 29, 2012 15:19
Extension of the handy autolink jQuery plugin, so that it has a method for handling twitter hashtags. Original from http://kawika.org/jquery/index.php
@tszarzynski
tszarzynski / ISampleInterface.as
Created August 30, 2012 10:14
Lightweight AS3 coding standard example
/*
* Copyright (c) 2012 Agency Republic
*
* Permission is hereby granted to use, modify, and distribute this file
* in accordance with the terms of the license agreement accompanying it.
*/
package com.agencyrepublic.template
{
/**
* Sample interface class.