This file contains 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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
{ | |
/* Keybindings for emacs emulation. Compiled by Jacob Rus. | |
* | |
* This is a pretty good set, especially considering that many emacs bindings | |
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and | |
* perhaps a few more, are already built into the system. | |
* | |
* BEWARE: | |
* This file uses the Option key as a meta key. This has the side-effect | |
* of overriding Mac OS keybindings for the option key, which generally |
This file contains 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
// jQuery version | |
$("input[type='number']").each(function(i, el) { | |
el.type = "text"; | |
el.onfocus = function(){this.type="number";}; | |
el.onblur = function(){this.type="text";}; | |
}); | |
// Stand-alone version | |
(function(){ var elms = document.querySelectorAll("input"), i=elms.length; | |
while(i--) { |
This file contains 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
#When dropbox is not working on ubuntu 12 | |
#you tried to execute on terminal: | |
#dropbox start | |
#and the error is something like this: | |
#Starting Dropbox.../home/YOUR_USER/.dropbox-dist/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required #by /usr/lib/x86_64-linux-gnu/libproxy.so.1) | |
#Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so | |
#Done! | |
#FIX | |
cd /home/YOUR_USER/.dropbox-dist/ |
This file contains 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 django import template | |
from django.core.urlresolvers import reverse | |
register = template.Library() | |
@register.simple_tag | |
def add_active(request, name, by_path=False): | |
""" Return the string 'active' current request.path is same as name | |
Keyword aruguments: |
This file contains 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
# -*- Encoding: utf-8 -*- | |
import base64 | |
import binascii | |
import cgi | |
import hashlib | |
import hmac | |
import logging | |
import time | |
import urllib | |
import urlparse |
This file contains 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
#!/usr/bin/env python | |
#-*- coding:utf-8 -*- | |
import sys | |
import StringIO | |
import requests | |
import PIL.Image | |
import tesserwrap |
This file contains 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# zipdb.py | |
# Use a zipfile store a dict like k-v database. | |
# Known bug: duplicate key(filenames) allowed | |
# | |
# Copyright 2012 mayli <[email protected]> | |
# |