Skip to content

Instantly share code, notes, and snippets.

@lotsofcode
lotsofcode / gist:5092167
Created March 5, 2013 17:32
Markdown Template

Sample Markdown Cheat Sheet

This is a sample markdown file to help you write Markdown quickly :)

If you use the fabulous [Sublime Text 2 editor][ST2] along with the [Markdown Preview plugin][MarkdownPreview], open your ST2 Palette with CMD+P then choose Markdown Preview in browser to see the result in your browser.

Text basics

this is italic and this is bold . another italic and another bold

@lotsofcode
lotsofcode / installing-java.sh
Created February 24, 2013 13:27
Sun/Oracle Java on Ubuntu 12.10
sudo add-apt-repository ppa:webupd8team/java;
sudo apt-get update;
sudo apt-get install oracle-java8-installer;
@lotsofcode
lotsofcode / gist:5014949
Created February 22, 2013 17:04
Playing with functions and closures
function foobar(binary) {
return function(a) {
return function (b) {
if (typeof binary == 'function') { // binary
return binary(a, b);
} else if (typeof window[binary] == 'function') { // string
return window[binary](a, b);
} else {
throw "Invalid function provided";
}
// $mq-mobile-portrait : 320px !default;
// $mq-mobile-landscape : 480px !default;
// $mq-tablet-portrait : 640px !default; -- changed because i want my blog content is around this wide, not 768. you should let content & design determine your breakpoints
// $mq-tablet-landscape : 1024px !default;
// $mq-desktop : 1382px !default;
$mq-mobile-portrait : 20em !default;
$mq-mobile-landscape : 30em !default;
$mq-tablet-portrait : 40em !default;
$mq-tablet-landscape : 64em !default;
@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);
cd PATH_TO_YOUR_DEVKIT_DIR
ruby dk.rb init
ruby dk.rb install
@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)
@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 / 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 / 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