Skip to content

Instantly share code, notes, and snippets.

@anthonyshort
anthonyshort / gist:1164009
Created August 23, 2011 00:28
Test RGB mixin
@mixin rgb($property, $red, $green, $blue) {
#{$$property}:opacify(rgb($red, $green, $blue), 1);
#{$$property}:$color;
}
#id {
@include rgb(background, 255, 255, 255);
}
@anthonyshort
anthonyshort / gist:1176576
Created August 28, 2011 11:40
Git Bash Profile
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
PS1="$RED\$ \w$YELLOW \$(parse_git_branch)$GREEN\$ "
@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);
@anthonyshort
anthonyshort / gist:1241364
Created September 26, 2011 00:26
GiantBomb - Game Details
{ "error" : "OK",
"limit" : 1,
"number_of_page_results" : 1,
"number_of_total_results" : 1,
"offset" : 0,
"results" : { "aliases" : "",
"api_detail_url" : "http://api.giantbomb.com/game/7856/",
"characters" : [ { "api_detail_url" : "http://api.giantbomb.com/character/5/",
"id" : 5,
"name" : "Zelda",
@anthonyshort
anthonyshort / gist:1335319
Created November 2, 2011 23:42
Remove local merged git branches
function rlmb {
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo "Fetching merged branches..."
#git remote prune origin
#remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$")
local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$")
if [ -z "$local_branches" ]; then
@anthonyshort
anthonyshort / framework.scss
Created November 30, 2011 01:54
Grid Framework
$grid-columns: 12;
$grid-width: 63px;
$grid-gutter-width: 20px;
@function grid-width($n) {
@return ($n * $grid-width) + (($n - 1) * $grid-gutter-width);
}
.l-container {
<script>
window.doLater = {};
doLater.foo = function(){
// Do some shiz here!
$('body').append('foobars!');
};
</script>
<script src="jquery.js"></script>
@anthonyshort
anthonyshort / gist:1573747
Created January 7, 2012 04:04
Middleman + Cloud9 IDE
1. Push Middleman site to Github
2. Clone project in Cloud9 IDE
3. Add Heroku as a deploy server in the IDE
4. Add articles, pages etc in the IDE
5. Deploy to Heroku
You could even setup a second Heroku site as a staging site before you deploy to live demo new articles.
@anthonyshort
anthonyshort / _media-queries.scss
Created March 13, 2012 10:37
Media Queries in Sass
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
@anthonyshort
anthonyshort / backbone.extensions.coffee
Created April 12, 2012 00:08
Some Backbone extensions I've put together based on Chaplin. I wanted to customize some of the 'framework' parts. It's a work in progress. Attaching them to the Backbone object makes them easier to work with across projects that don't use require.js.
'use strict'
# --------------------------------------------------
# EventEmitter
# --------------------------------------------------
emitter = Backbone.EventEmitter = _.extend {}, Backbone.Events
# --------------------------------------------------
# Global subscriptions