Skip to content

Instantly share code, notes, and snippets.

View clvrobj's full-sized avatar

Chi Zhang clvrobj

  • Singapore, Singapore
View GitHub Profile
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
@lsbardel
lsbardel / redis-server-for-init.d-startup
Created December 15, 2009 21:01 — forked from mtodd/redis-server-for-init.d-startup
Init.d Redis script for Ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@ieure
ieure / python-pep8.el
Created February 12, 2010 18:49
Run pep8.py on Python source in Emacs.
;;; python-pep8.el --- minor mode for running `pep8'
;; Copyright (c) 2009, 2010 Ian Eure <[email protected]>
;; Author: Ian Eure <[email protected]>
;; Keywords: languages python
;; Last edit: 2010-02-12
;; Version: 1.01
@ieure
ieure / python-pylint.el
Created February 12, 2010 18:49
Run pylint on Python source in Emacs.
;;; python-pylint.el --- minor mode for running `pylint'
;; Copyright (c) 2009, 2010 Ian Eure <[email protected]>
;; Author: Ian Eure <[email protected]>
;; Keywords: languages python
;; Last edit: 2010-02-12
;; Version: 1.01
@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);
@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)
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@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)
@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 {
html {
overflow: hidden;
height: 100%;
}
body {
overflow-y: scroll;
height: 100%;
}