Skip to content

Instantly share code, notes, and snippets.

View GuoJing's full-sized avatar
🎯
Focusing

GuoJing GuoJing

🎯
Focusing
View GitHub Profile
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",
@GuoJing
GuoJing / vimrc
Last active December 14, 2015 11:38
my vimrc
" First install Vundle
" git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
@GuoJing
GuoJing / solarized.vim
Created March 4, 2013 08:14
my customized solarized theme for vim.
" Name: Solarized vim colorscheme
" Author: Ethan Schoonover <[email protected]>
" URL: http://ethanschoonover.com/solarized
" (see this url for latest release & screenshots)
" License: OSI approved MIT license (see end of this file)
" Created: In the middle of the night
" Modified: 2011 May 05
"
" Usage "{{{
"
@GuoJing
GuoJing / gevent_pycurl.py
Created June 27, 2013 09:55
pycurl for gevent.
"""Implementation of pycurl's "easy" interface that uses pycurl's multi interface + gevent.
"""
# parts of code from Tornado's curl_httpclient.py
import logging
import gevent
assert gevent.version_info[:2] >= (0, 14), 'Gevent 0.14 or older required. Your version is %s' % gevent.__version__
from gevent.core import EVENTS, READ, WRITE
from gevent.hub import Waiter
@GuoJing
GuoJing / test.py
Last active August 29, 2015 13:56
import os
import time
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler
def sync_delete(event):
print 'delete %s' % event.src_path
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the _run() method
"""
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef int heap_elem_t;
typedef struct heap_t
{
int size;
int capacity;
#include <stdio.h>
#include <stdlib.h>
struct page {
int value;
page *next;
};
int miss = 0;
int hit = 0;
#include <stdio.h>
#include <stdlib.h>
struct node {
node *left;
node *right;
node *parent;
int value;
};
@GuoJing
GuoJing / rbtree.c
Last active September 29, 2022 15:06
simple rbtree source code
#include <stdio.h>
#include <stdlib.h>
int BLACK = 0;
int RED = 1;
struct node {
struct node *left;
struct node *right;
struct node *parent;