Skip to content

Instantly share code, notes, and snippets.

View aaronmcadam's full-sized avatar
🎉
Having fun!

Aaron McAdam aaronmcadam

🎉
Having fun!
View GitHub Profile
@matthewmccullough
matthewmccullough / git-deletealltags.bsh
Created April 1, 2011 20:29
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done
@cowboy
cowboy / clone_fast.rb
Created April 12, 2011 21:19
Ruby: Clone Yer GitHub Repos, Fast!
# /usr/bin/env ruby
puts <<-EOF
Clone Yer GitHub Repos, Fast! - v0.2.1 - 4/13/2011
http://benalman.com/
For when you're on a new computer and need all your stuff, fast!
EOF
copyright = <<-EOF
@aaronmcadam
aaronmcadam / serializeForm.js
Created April 19, 2011 15:18
outputs form data as "{ username : 'abc', password : 'abc' ... } instead of "{ 'name' : 'username', 'value' : 'abc' ... }
var signUp = function () {
var signupData = $( '#competition_form' ).serializeArray(),
params = {};
// setup params data from signupData
signupData.map( function( value ) {
params[value.name] = value.value;
} );
// set required data
$.extend( params, {
@cowboy
cowboy / jquery.ba-deparam.js
Created June 14, 2011 20:39
jQuery Deparam -- WORK IN PROGRESS -- NOT DONE YET
// jQuery Deparam - v0.1.0 - 6/14/2011
// http://benalman.com/
// Copyright (c) 2011 Ben Alman; Licensed MIT, GPL
(function($) {
// Creating an internal undef value is safer than using undefined, in case it
// was ever overwritten.
var undef;
// A handy reference.
var decode = decodeURIComponent;
@chriseppstein
chriseppstein / _grid-system.scss
Created August 22, 2011 17:43
Building Responsive Layouts with Sass
@import "compass/utilities/general/clearfix";
$gutter-width: 10px; // All grids systems have the same gutter width
$float-direction: left;
$left-gutter-width: ceil($gutter-width / 2) !default;
$right-gutter-width: $gutter-width - $left-gutter-width !default;
$base-line-height: 21px;
$show-grid-background: false;
@mixin centered {
@anthonyshort
anthonyshort / gist:1178298
Created August 29, 2011 12:31
Prefixing with Sass
@mixin border-radius($radius, $prefixes: -moz -webkit -o) {
@each $prefix in $prefixes {
#{$prefix}-border-radius:$radius;
}
border-radius:$radius;
}
#id {
@include border-radius(5px, -moz -webkit);
@davidbanham
davidbanham / gist:1186032
Created September 1, 2011 12:02
Dynamically generate a file download in express without touching the filesystem
var express = require('express');
var app = require('express').createServer();
app.listen('3030');
app.get('/', function(req, res) {
res.contentType('text/plain');
res.send('This is the content', { 'Content-Disposition': 'attachment; filename=name.txt' });
});
@aaronmcadam
aaronmcadam / compass-inotify.rb
Created September 5, 2011 19:06
compass-inotify
# add to config.rb
# install libnotify gem if missing
require 'libnotify'
# success callback
on_stylesheet_saved do |filename|
Libnotify.show :summary => "#{File.basename(filename)}", :body => "Updated", :icon_path => "/usr/share/icons/gnome/256x256/actions/view-refresh.png"
end
@cowboy
cowboy / ba-bbq-ideas.js
Created September 19, 2011 20:11
BBQ ideas.
// jQuery BBQ ideas
// ============================================================================
// MESSAGING BUS
// ============================================================================
var publish = function(message) {
location.hash = '#' + message;
};
@mattwynne
mattwynne / gist:1228927
Created September 20, 2011 11:52
eventually helper method for making assertions against asynchronous systems
# usage:
# it "should return a result of 5" do
# eventually { long_running_thing.result.should eq(5) }
# end
module AsyncHelper
def eventually(:options = {})
timeout = options[:timeout] || 2
interval = options[:interval] || 0.1
time_limit = Time.now + timeout
loop do