Skip to content

Instantly share code, notes, and snippets.

@charud
charud / module-js.sublime-snippet
Created March 7, 2012 08:00
Lightweight Javascript Module
<snippet>
<content><![CDATA[
var ${1} = ${1} || {};
${1}.${2} = (function(me)
{
${3}
return me;
})(${1}.${2} || {});
@charud
charud / module-js-init.sublime-snippet
Created March 7, 2012 08:01
Init method for Lightweight Javascript Module
<snippet>
<content><![CDATA[
me.init = function()
{
${1}
};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>init</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@charud
charud / module-js-priv.sublime-snippet
Created March 7, 2012 08:01
Private method of Lightweight Javascript Module
<snippet>
<content><![CDATA[
var ${1} = function(${2})
{
${3}
};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>priv</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@charud
charud / module-js-pub.sublime-snippet
Created March 7, 2012 08:02
Public method of Lightweight Javascript Module
<snippet>
<content><![CDATA[
me.${1} = function(${2})
{
${3}
};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>pub</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@charud
charud / module-js-multi.sublime-snippet
Created March 7, 2012 08:03
Lightweight Javascript Module with support for many instances
<snippet>
<content><![CDATA[
var ${1:Namespace} = ${1:Namespace} || {};
${1:Namespace}.${2:Module} = function(options)
{
var me = {};
me.init = function()
{
@charud
charud / tmpl-js.sublime-snippet
Created March 7, 2012 08:05
Template Tag for JQuery Templates
<snippet>
<content><![CDATA[
<script id="${1}" type="text/x-jquery-tmpl">
${2}
</script>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>tmpl</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
@charud
charud / iptablesPort80To8080
Created August 4, 2012 22:32
Forward port 80 to port 8080 with iptables
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
@charud
charud / Lunarizer
Created August 13, 2012 14:06
Lunarize a string from shell
#!/bin/sh
#
# Lunarizer
# =========
#
# Installation
# ------------
# $ curl https://raw.github.com/gist/3341070/44869be7b0b7b7403465a78cde1ec3e3ce6e2788/Lunarizer > lunar; chmod +x lunar
# $ sudo cp lunar /usr/local/bin/lunar
#
set shell=bash
" this combination gives absolute number for the current line
set relativenumber
set number
"set statusline=%f
set laststatus=2
set tabstop=4
@charud
charud / Fish Config
Last active November 20, 2016 21:28
# Autojump
[ -f /usr/local/share/autojump/autojump.fish ]; and . /usr/local/share/autojump/autojump.fish ]
# [ -f /usr/local/Cellar/autojump/22.2.4/share/autojump/autojump.fish ]; and . /usr/local/Cellar/autojump/22.2.4/share/autojump/autojump.fish ]
# Git Branch in terminal
set fish_git_dirty_color red
set fish_git_not_dirty_color green
function parse_git_branch