Skip to content

Instantly share code, notes, and snippets.

View manafire's full-sized avatar

Brad Carson manafire

View GitHub Profile
@manafire
manafire / jquery.plugin-template.js
Created November 13, 2012 22:48 — forked from Air-Craft/jquery.plugin-template.js
jQuery Plugin Design Pattern/Template Improved!
// if (!window.L) { window.L = function () { console.log(arguments);} } // optional EZ quick logging for debugging
/**
* A modified (improved?) version of the jQuery plugin design pattern
* See http://docs.jquery.com/Plugins/Authoring (near the bottom) for details.
*
* ADVANTAGES OF EITHER FRAMEWORK:
* - Encapsulates additional plugin action methods without polluting the jQuery.fn namespace
* - Ensures ability to use '$' even in compat modes
*
@manafire
manafire / Compass.sublime-build
Created January 10, 2013 19:25
SublimeText2 Compass Build file with rbenv
{
"cmd": "cd '$project_path'; compass watch",
"working_dir": "$packages/Compass",
"selector": "source.sass, source.scss",
// "shell": "true",
"osx": {
// "watch" with SublimeOnSaveBuild package creates multiple ruby instances & memleaks, so we use "compile" instead
"cmd": ["/Users/bcarson/.rbenv/shims/compass", "compile", "$project_path"]
},
"windows":
@manafire
manafire / gist:5729868
Created June 7, 2013 14:58
Autoload Hirb whenever you're in Rails console
# config/initializers/hirb.rb
Hirb.enable if Rails.env.development?
(function () {
var scriptName = "embed.js"; //name of this script, used to get reference to own tag
var jQuery; //noconflict reference to jquery
var jqueryPath = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";
var jqueryVersion = "1.8.3";
var scriptTag; //reference to the html script tag
/******** Get reference to self (scriptTag) *********/
var allScripts = document.getElementsByTagName('script');
@manafire
manafire / gist:6232957
Created August 14, 2013 16:45
Override read-only in vim with :w!!
# add to .vimrc
cmap w!! %!sudo tee > /dev/null %
@manafire
manafire / gist:6251199
Created August 16, 2013 16:07
Sublime Keymap
[
{ "keys": ["ctrl+shift+r"], "command": "reindent" , "args": {"single_line": false}},
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
// vintage - mode control
// exit insert mode
{ "keys": ["j", "j"], "command": "exit_insert_mode",
"context":
[
@manafire
manafire / gist:6370017
Created August 28, 2013 19:13
Amazon Everyone Read-only public bucket policy
{
"Version":"2008-10-17",
"Statement":[{
"Sid":"AllowPublicRead",
"Effect":"Allow",
"Principal": {
"AWS": "*"
},
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::BUCKET_NAME/*"
@manafire
manafire / gist:6543773
Created September 12, 2013 21:04
AWS Full bucket access
{
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": "s3:*",
@manafire
manafire / gist:7949060
Last active December 31, 2015 06:39
Change directory by substituting a string in current working directory with another. Throw this in your aliases file or your rc, or profile file and enjoy.
#
# CD substitution
# usage: cds [target] [substitution]
#
# if you have a current working directory like this:
# ~/code/myproject/en/images/
# and you type: cds en fr
# you will change to this directory:
# ~/code/myproject/fr/images/
@manafire
manafire / gist:c385b40031309af1c9d6
Last active August 29, 2015 14:01
Ubuntu + rbenv + github + Rails + Ruby + nginx + passenger + ec2
# IN AMAZON EC2 SERVER #
########################
sudo su
apt-get -y update && apt-get -y upgrade
apt-get install vim git-core curl openssh-server openssh-client python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev aptitude
/usr/sbin/groupadd wheel
/usr/sbin/visudo
(paste bottom)
%wheel ALL=(ALL) ALL