This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the basename (of the file in which the snippet is invoked) as a sensible | |
# default for module names. Supports JSX files as well. | |
global !p | |
def module_name(name=None): | |
name = name or 'ModuleName' | |
s1 = re.sub('\.js(x?)$', '', name) | |
return ''.join(x.title() for x in re.sub('([A-Z])', r'_\1', s1).split('_')) | |
endglobal | |
# Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<!-- | |
Based on: http://www.reddit.com/r/gifs/comments/2on8si/connecting_to_server_so_mesmerizing/ | |
See also: http://codepen.io/anon/pen/OPMvOb | |
http://jsbin.com/xecosiyomo/1/edit?js,output | |
--> | |
<head> | |
<title>Mesmerizing</title> | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RouterModel extends Store.Model { | |
constructor() { | |
this.defaults = { | |
route: conf.ROUTE_DEFAULT, | |
params: [] | |
}; | |
super(); | |
} | |
initialize() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window, document, undefined) { | |
"use strict"; | |
var _cache; | |
var _local = window.localStorage; | |
var _session = window.sessionStorage; | |
/** | |
* Validate a well-formed cache/storage object (used internally). | |
* @function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var im = require('imagemagick-native'); | |
var fs = require('fs'); | |
var buffer = fs.readFileSync('./test.gif'); | |
// test.gif --> http://c.2dr.me/Vckz | |
var resizedBuffer = im.convert({ | |
srcData: buffer, | |
width: 48, | |
height: 48, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; let expression is an IIFE (provides lexical scope) | |
(let [name "Vick" | |
msg "Much appreciated"] | |
(println (str "Thanks, " name)) | |
(println msg)) | |
;; => Thanks, Vick | |
;; => Much appreciated! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table.ranks tr { | |
background: red; | |
color: white; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Blue Component</key> | |
<real>0.07884746789932251</real> | |
<key>Green Component</key> | |
<real>0.081504985690116882</real> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// credit: http://davidshariff.com/blog/javascript-inheritance-patterns/ | |
(function () { | |
'use strict'; | |
/*************************************************************** | |
* Helper functions for older browsers | |
***************************************************************/ | |
if (!Object.hasOwnProperty('create')) { | |
Object.create = function (parentObj) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet get "Get Elements" | |
getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2') | |
endsnippet | |
snippet '':f "object method string" | |
'${1:${2:#thing}:${3:click}}': function(element){ | |
$0 | |
}${10:,} | |
endsnippet |