Skip to content

Instantly share code, notes, and snippets.

@pylemon
pylemon / 0_reuse_code.js
Created September 29, 2016 08:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pylemon
pylemon / EmacsKeyBinding.dict
Created December 29, 2015 08:14 — forked from jwreagor/EmacsKeyBinding.dict
Global Emacs Key Bindings for OS X
{
/* 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
@pylemon
pylemon / html5_number_field_fixes.js
Last active August 29, 2015 13:57 — forked from aaronsnoswell/gist:3786176
让html5 number 字段显示的 placeholder 可以为非数字
// 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--) {
@pylemon
pylemon / gist:3963079
Created October 27, 2012 05:37 — forked from douglasmiranda/gist:2527687
linux: fixing dropbox - Ubuntu 12
#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/
@pylemon
pylemon / active_tag.py
Created September 25, 2012 02:15 — forked from mnazim/active_tag.py
django: A simple template tag to add an 'active' class to anchor tags
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:
@pylemon
pylemon / __init__.py
Created September 10, 2012 02:35 — forked from ipconfiger/__init__.py
python: OAuth for sina, qq, 163, sohu
# -*- Encoding: utf-8 -*-
import base64
import binascii
import cgi
import hashlib
import hmac
import logging
import time
import urllib
import urlparse
@pylemon
pylemon / extract_captcha.py
Created July 28, 2012 06:41 — forked from tonyseek/extract_captcha.py
python: Distinguish captcha with PIL and Tesseract
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import StringIO
import requests
import PIL.Image
import tesserwrap
@pylemon
pylemon / zipdb.py
Created May 30, 2012 05:10 — forked from mayli/zipdb.py
python: Use a zipfile store a dict like k-v database
#!/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]>
#