Skip to content

Instantly share code, notes, and snippets.

View yanyaoer's full-sized avatar

yanyaoer yanyaoer

View GitHub Profile
@ssokolow
ssokolow / background-page.html
Created June 29, 2010 03:59 — forked from romannurik/background-page.html
Simple cross-domain XHR boilerplate for Chrome extensions. Modified to be more useful for POST
<!DOCTYPE html>
<html>
<head>
<script src="xhrproxy.js"></script>
<script>
setupXHRProxy();
</script>
</head>
# Copyright (c) 2010, Philip Plante of EndlessPaths.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
#!/bin/sh
# Change this line to the URI path of the xcode DMG file.
# XCode 3.2.5
#XCODE_PATH="/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg"
# XCode 4
#XCODE_PATH="/Developer_Tools/xcode_4_and_ios_sdk_4.3__final/xcode_4_and_ios_sdk_4.3__final.dmg"
@parente
parente / runinenv.sh
Created February 15, 2011 01:54
run a command in virtualenv, useful for supervisord
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@didip
didip / model-tests-in-tornado.py
Created March 12, 2011 23:24
Example on how to tests your model classes in Tornado
import unittest, os, os.path, sys
import tornado.database
import tornado.options
from tornado.options import options
APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(APP_ROOT, '..'))
# import your model module
import your.model as model
@ZoomQuiet
ZoomQuiet / gist:948080
Created April 29, 2011 09:08 — forked from lxneng/gist:472566
from lxneng 通用的 fabric 部署脚本原型
#!/usr/bin/env python
# encoding: utf-8
"""
Usage:
fab deploy:appname
"""
from fabric.api import env, run, cd, local, put
env.hosts = ['myserver.com']
env.user = 'eric'
@jeresig
jeresig / .vimrc
Created May 4, 2011 16:46
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
@sofish
sofish / textStorage.js
Created September 16, 2011 03:13
Cross-browser TextStorage Solution
/**
* @ NAME: Cross-browser TextStorage
* @ DESC: text storage solution for your pages
* @ COPY: sofish, http://sofish.de
*/
typeof window.localStorage == 'undefined' && ~function () {
var localStorage = window.localStorage = {},
prefix = 'data-userdata',
doc = document,
@wheresalice
wheresalice / redisdns.py
Created November 27, 2011 12:56
Python DNS server with Redis backend
# A naive dns server with a Redis backend
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1)
# Tip: Use Redis's ttl functions to have temporary names
# Currently only does A records, feel free to fix that
#
# Licensed under the PSF License
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/
# Author: @Kaerast <alice@kaerast.info>
import socket
@lamnk
lamnk / pypy_symlink.sh
Created December 12, 2011 00:17
Some symlinks needed to run pypy on CentOS 5.7 x64