Skip to content

Instantly share code, notes, and snippets.

View clvrobj's full-sized avatar

Chi Zhang clvrobj

  • Singapore, Singapore
View GitHub Profile
#ab -n 100000 http://127.0.0.1:8880/hello/world
#You have to run Sentry at 127.0.0.1:8000 and replace the following DSN.
from bottle import route, run
@route('/hello/:name')
def index(name='World'):
from raven import Client
client = Client('http://48ca560b5e2b4fe8b8802ed29c54de81:[email protected]:8000/2')
client.captureMessage('hello world!')
@disinfeqt
disinfeqt / gist:2286703
Created April 2, 2012 19:47
YYETS Copy
(function(){
var output = '';
for(var i = 0,array = document.querySelectorAll('.hover.filebox')[0].querySelectorAll('li'); i<array.length-1; i++){
if(array[i].querySelector('input').checked && array[i].querySelector('a').href.length > 0 && array[i].querySelector('a').href.match('-----') === null){
output += array[i].querySelector('a').href + '\n';
}
}
alert(output);
})();
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
r1 = {'a': {'q': 1, 'w': 2}, 'b': {'q': 3, 'w': 4}}
r2 = {'a': {'q': 5, 'w': 7}, 'b': {'q': 8, 'w': 2}}
# ret = {'a': {'q': 6, 'w': 9}, 'b': {'q': 11, 'w': 6}}
a = lambda x, y: list(zip(x.keys(), list(zip(x.values(), y.values()))))
rs = reduce(a, (r1, r2))
print rs
#print reduce(a, map(lambda r: r[1], rs))
html {
overflow: hidden;
height: 100%;
}
body {
overflow-y: scroll;
height: 100%;
}
@seaneagan
seaneagan / dartReflect.dart
Created November 27, 2011 22:51
Dart reflection
interface IsolateMirror {
final LibraryMirror rootLibrary;
StackMirror stack();
MirrorGroup<LibraryMirror> imports;
MirrorGroup<ReceivePort> ports; // not sure what is used as the name of a port
}
// invocation
interface InvocationMirror {
@jollychang
jollychang / check_tickets.py
Created November 16, 2011 03:51
check chncpa tickets
# -*- coding: utf-8 -*-
#! /usr/bin/python
import urllib2
import requests
import os
import time
from BeautifulSoup import BeautifulSoup
from pync import Notifier
import sys
reload(sys)
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@slackorama
slackorama / js-beautify.el
Created November 23, 2010 19:51
beautify some js code in emacs
;;; js-beautify.el -- beautify some js code
(defgroup js-beautify nil
"Use jsbeautify to beautify some js"
:group 'editing)
(defcustom js-beautify-args "--jslint-happy --brace-style=end-expand --keep-array-indentation"
"Arguments to pass to jsbeautify script"
:type '(string)
:group 'js-beautify)
@mathiasbynens
mathiasbynens / jquery.crash-ie.js
Created April 8, 2010 11:53
jQuery Crash plugin — updated to work with IE6, IE7 and IE8
/*!
* jQuery Crash for IE6, IE7 and IE8
* @description This is an expansion of the jQuery Crash plugin for IE6 by Chad Smith.
* @author Mathias Bynens <http://mathiasbynens.be/>
* Use $.crashIE6(); and/or $.crashIE7(); and/or $.crashIE8();
*/
;
$.crashIE6 = function(x) {
if ($.browser.msie && $.browser.version < 7) {
for (x in document.open);