Skip to content

Instantly share code, notes, and snippets.

@zhiyelee
zhiyelee / post-receive.sh
Created March 5, 2012 10:18
hooks/post-receive.sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a she ll session *as a function*
GEM_PATH=$GEM_PATH:/usr/local/rvm/gems/ruby-1.9.2-p290
PATH=$PATH:/usr/local/rvm/gems/ruby-1.9.2-p290/bin
GIT_WORK_TREE=$HOME/octopress/ git checkout -f
cd $HOME/octopress/
bundle install
bundle exec rake generate
@zhiyelee
zhiyelee / getip.php
Created March 31, 2012 02:41
twtter get ip
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Get IP</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php
$domains = array('api.twitter.com', 'twitter.com');
/**
* merge sort
**/
var arr = [8,7,9,30,13,8,99,124, 5];
//var arr = [1,10,9];
var newArr = [];
var ii = 0;
/**
* @description check dot whether in a triangle
* @author zhiyelee
*/
/**
* for tri like below:
* A
* * *
* B * * * C
@zhiyelee
zhiyelee / .gitignore
Last active December 19, 2015 12:19
node js demo
node_modules
@zhiyelee
zhiyelee / README.md
Last active December 23, 2015 03:08
yui oop demos

yui oop demo gist

  • merge mix

  • OOP

    • extend
    • augment
    • aggregate
  • bind rbind

@zhiyelee
zhiyelee / animal_rabbit.js
Last active August 29, 2015 13:56
__proto__
var animal = { eats: true }
var rabbit = { jumps: true }
rabbit.__proto__ = animal // inherit
console.log(rabbit.eats) // true
var animal = { eats: true }
rabbit = Object.create(animal);
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="instanceof cross iframe" />
<meta charset="utf-8">
<title>instanceof cross iframe</title>
</head>
<body>
<iframe id="fr" ></iframe>
@zhiyelee
zhiyelee / description.markdown
Last active August 29, 2015 13:57
gView sample -- this description will be showed in the head of the page and used as the title. I just want to make this description long enough.

View gists in a more grace page.

Usage

visit http://g.zhiye.li/:gistid to view the gist, eg

// for below gitst 
https://gist.github.com/zhiyelee/9403314
@zhiyelee
zhiyelee / 236-a.js
Last active August 29, 2015 13:59
codeforces
// http://codeforces.com/contest/236/problem/A
function judge(str) {
var arr = str.split('');
var obj = {};
var len = 0;
for (var i = 0; i < arr.length; i++) {
if (!obj[arr[i]]) {
obj[arr[i]] = 1;
len ++;