Skip to content

Instantly share code, notes, and snippets.

@lotsofcode
lotsofcode / gist:2375846
Created April 13, 2012 10:56
Useful git commands

Show commits different between (could be useful or generating a changelog)

git log origin/master..master --format="%h %s [%an]"

Essentially, this is a git log ..

Pretty log format

git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short

@lotsofcode
lotsofcode / gist:2503723
Created April 26, 2012 22:27
jQuery Boilerplate
;(function($, undefined) {
$.REPLACE_PLUGIN_NAME = function(element, options) {
var defaults = {}
var plugin = this;
plugin.settings = {}
var $element = $(element), element = element;
plugin.init = function() {
plugin.settings = $.extend({}, defaults, options);
private_method()
plugin.public_method()
@lotsofcode
lotsofcode / gist:2556913
Created April 30, 2012 09:46
iterate through templates and create sub-templates
TEMPLATES=$(cat templates.txt);
SUB_TEMPLATES=$(cat sub-templates.txt);
for SUB_TEMPLATE in $SUB_TEMPLATES; do
for TEMPLATE in $TEMPLATES; do
touch templates/$TEMPLATE.$SUB_TEMPLATES.txt
done
done
@lotsofcode
lotsofcode / Custom.css
Created May 25, 2012 10:00 — forked from bentruyman/Custom.css
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@lotsofcode
lotsofcode / readme2ghpage.rb
Created June 22, 2012 15:37 — forked from hopsoft/readme2ghpage.rb
Convert your README.md on master to index.md on gh-pages
#!/usr/bin/env ruby
# checkout the readme from the master branch
`git checkout gh-pages; git checkout master README.md`
path = `pwd`.gsub(/\n/, "")
readme_path = File.join(path, "README.md")
index_path = File.join(path, "index.md")
# write the index readme file
@lotsofcode
lotsofcode / new_bashrc.sh
Created August 11, 2012 09:17 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
@lotsofcode
lotsofcode / slug.js
Created October 4, 2012 15:32 — forked from bentruyman/slug.js
JavaScript Slug Generator
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
function generateSlug (value) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters and dashes
return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
};
@lotsofcode
lotsofcode / jQuery.ajaxQueue.min.js
Created October 11, 2012 16:04 — forked from gnarf/jQuery.ajaxQueue.min.js
jQuery.ajaxQueue - A queue for ajax requests
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)
cd PATH_TO_YOUR_DEVKIT_DIR
ruby dk.rb init
ruby dk.rb install
@lotsofcode
lotsofcode / gist:3906542
Created October 17, 2012 16:29
jQuery fade child element
$.fn.childFader = function(options) {
var settings, defaults;
defaults = {
opacity: .5,
hoverOpacity: 1,
child: 'img'
};
settings = $.extend({}, defaults, options);
return $(this).each(function(options) {
var child = $(settings.child, this);