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
javascript:(function(){ | |
var body = window.document.body, | |
hh = body.scrollTop, | |
interval = null, | |
style_div = "font-family:helvetica;border-radius:5px;border:1px solid #222;border-bottom: 2px solid #111;padding:10px;position:fixed;top:20px;left:20px;background:#555", | |
style_link = "padding: 5px;background:#222;color:#eee;text-decoration:none;margin:5px;", | |
tpl = "<div id='stoppy' style='" + style_div + "'><a style='" + style_link + "' href='#' id='start-btn'>start</a> \ | |
<a style='" + style_link + "' href='#' id='stop-btn'>stop</a>"; |
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
from contextlib import contextmanager | |
@contextmanager | |
def files(*ff): | |
fi = [ open(*f) if len(f) == 2 else open(f) for f in ff ] | |
yield(fi) | |
map(close,fi) |
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
/** | |
* PicoTemplate | |
* syntax (there is barely any) | |
* | |
* <a href="{{ url }}">{{ movie.title }}</a> | |
* NO LOGIC! | |
**/ | |
function __deep(obj, prop) { | |
var parts = prop.split('.'), i = -1, l = parts.length; | |
while(++i < l) { |
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
### | |
# API Client for "MyApi" | |
### | |
require 'httparty' | |
require 'yaml' | |
module MyApi | |
class Config | |
attr_accessor :base_url, :page_size, :key |
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
/* Why would you ever need a switch statement in javascript? */ | |
var switchy = { | |
1: function(x){ return x*x; }, | |
pizza: function(x){ return x*x*X } | |
}; | |
var bar = switchy[foo](10); | |
// what if you could extend it with regex? |
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
/** | |
* URL Parsing "Library"/function | |
* https://github.com/websanova/js-url <-- this is unnecessarily complex | |
*/ | |
;(function _url(window,undefined){ | |
function Url(url){ | |
this.elem = window.document.createElement('a'); | |
this.elem.href = url || window.location; | |
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
:%s/\s\([_a-z]*\):\s/:\1 => /gi |
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
# Lusty Data | |
# A Computer Orgasm | |
# @author nickjacob | |
# | |
.excitement | |
movl $1, %eax | |
.rising | |
cmpl $0, %eax | |
je .climax |
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
/** | |
* This is my own idea of how I wish all javascript files looked. I don't think it's probably the "best" way (is there a *best* way?), but I like it | |
* and I think everyone should have some kind of style. | |
*/ | |
// name the IIFE for debugging/organization if you want to use a concatenation build tool | |
;(function this_module(window,undefined){ | |
var _public = {}, _private = {}; // if only it were real!!! Fun fact -- "public" is reserved! |
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
/*** | |
* lil' ball | |
* this isn't even a library. I just realized that I'd been using jQuery *only* because | |
* I needed an easy way to do ajax. So I finally got my sh** together an just wrote smtng. | |
* | |
* author: @nickjacob | |
***/ | |
;(function(window,undefined){ | |
window._o_ = window._o_ || {}; |