Skip to content

Instantly share code, notes, and snippets.

View haoch's full-sized avatar
🎯
Focusing

Hao Chen haoch

🎯
Focusing
View GitHub Profile
.codehilite {
pre, code {
color: #fdce93;
background-color: #2b2b2b;
}
.hll { background-color: #222222 }
.c { color: #7f9f7f } /* Comment */
.err { color: #e37170; background-color: #3d3535; } /* Error */
###
# Author : Chen,Hao
# Email : [email protected]
# Site : http://haoch.me
#
# Based on jekyll-bootstrap's Rakefile.
# Thanks, @plusjade
# https://github.com/plusjade/jekyll-bootstrap
###
@haoch
haoch / sublime-pygments.less
Created September 24, 2013 09:02
sublime pygment syntax highlight style
.highlight {
margin-bottom: 1.5em;
.font(12);
color: #d0d0d0;
border: 1px solid darken(@body-color, 5);
background-color: #272822;
.rounded(3px);
pre {
position: relative;
margin: 0;
@haoch
haoch / mongo_cursor_timeout.js
Created June 7, 2013 06:26
mongodb cursor imeout or restart
// Solution 1
// {code}
db.coll.find().addOption(16).forEach()
// {code}
// Solution 2
// {code}
db.coll.find().noTimeout().forEach()
// {code}
@haoch
haoch / javascript_proto_class
Created June 7, 2013 06:19
javascript prototype class
var constructor_func = function(){
// codes
}
var class_name = function(){
this.attr=null; // instance variable
this.attr2=null; // instance variable
}
class_name.prototype = {
@haoch
haoch / javascript_obj_closure
Created June 7, 2013 06:15
refer to arborjs.org: javascript object closure
(function(){
// TODO evironment logic
OBJECT_NAME=function(){
var that = {
init:function(){
that.func_name()
return that
},
func_name:function(){
// do func1
@haoch
haoch / base.scala.html
Created January 27, 2013 17:01
Play framework gist
@************************************************************************
* Base Page Template *
* *
* Parameters *
* pageid -- page id, for menu/page index,etc. *
* title -- page tile *
* styles -- page additional styles *
* scripts -- page additionalscripts,placed on the bottom of page *
* content -- page content,in the "container" *
* Description *
@haoch
haoch / log4j.properties
Last active October 13, 2015 03:48
log4j.properties
log4j.rootLogger=DEBUG,console,stdLog,errorLog
#console appender
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern = [%d{ISO8601}] %5p %6.6r [%t]%x %c - %m%n
#file appender
log4j.appender.stdLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.stdLog.DatePattern = '.'yyyy-MM-dd
@haoch
haoch / encodeURI
Created November 6, 2012 05:22
encodeURI for tastypie RESTful api framework
function encodeURI(params){
var request_url=[];
for(var i in params){
var target = params[i];
if(typeof target =='object'){ // when is list
for(var j in target){
request_url.push(i+"="+target[j]);
}
}else{
request_url.push(i+"="+params[i])
@haoch
haoch / AUTHORS
Created November 2, 2012 18:34
python release template(AUTHORS,CONTRIBUTING.rst,INSTALL,LICENSE,MANIFEST.in,README.rst,setup.cfg,setup.py)
{APP_NAME}was originally created in late 2003 at World Online, the Web division
of the Lawrence Journal-World newspaper in Lawrence, Kansas.
The PRIMARY AUTHORS are (and/or have been):
* Hao Chen <[email protected]>
More information on the main contributors to Django can be found in
docs/internals/committers.txt.