Skip to content

Instantly share code, notes, and snippets.

View chaozh's full-sized avatar
🎯
Focusing

chaozh chaozh

🎯
Focusing
View GitHub Profile
@rpavlik
rpavlik / fix_homebrew.rb
Created January 6, 2011 20:32 — forked from mxcl/install_homebrew.markdown
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@jhjguxin
jhjguxin / git_diff.md
Created August 6, 2012 07:40
Git diff 比较不同版本的差异

Git 比较不同版本文件差异的常用命令格式:

git diff                                       查看尚未暂存的文件更新了哪些部分

git diff filename 查看尚未暂存的某个文件更新了哪些

git diff –cached                    查看已经暂存起来的文件和上次提交的版本之间的差异

git diff –cached filename 查看已经暂存起来的某个文件和上次提交的版本之间的差异
@stephenh1988
stephenh1988 / simple-admin-page.php
Created September 8, 2012 15:59
A simple class based on a tutorial at WP.Tuts that creates an page with metaboxes.
<?php
/*
Description: A simple class based on a tutorial at WP.Tuts that creates an page with metaboxes.
Author: Stephen Harris
Author URI: http://www.stephenharris.info
*/
/* Copyright 2011 Stephen Harris (contact@stephenharris.info)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@sofish
sofish / scrollNews.js
Created October 18, 2012 01:54
Scroll News
// 完成滚动信息的简短代码
~function ($) {
/* 浮动信息插件
* @author sofish, linjianfeng@baixing.com
* @param options {Object} 加下的参数
* {
* data: 传入的 JSON 数据
* tmpl: 显示信息的格式模板 `{json 数组中 object 的 key 名} 发布了 {dataName}`
* 为了更快的匹配,{dataName} 中的 dataName 只支持除中文外的 js 变量名命名方法中支持的内容
@oldratlee
oldratlee / CalcDwsMonths.py
Created November 14, 2012 10:02
Get the months which First day is monday
# find the months which First day is monday
# My related Blog: http://oldratlee.com/post/2012-11-13/1-st-day-is-monday-month-count
dayCountOfMonthOfYear = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
dayCountOfMonthOfLeapYear = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
print "Day count of non-leap year: ", sum(dayCountOfMonthOfYear)
# 365, day count of non-leap year
print "Day count of leap year: ", sum(dayCountOfMonthOfLeapYear)
# 366, day count of Leap year
@yyx990803
yyx990803 / frameworks.md
Created December 3, 2012 21:52
国内互联网公司的前端框架简介

百度:Tangram

基本上就是个百度版jQuery,2.0版本使用链式API,更像了。
配套的还有UI库Magic和模版引擎BaiduTemplate(和ejs很像)

腾讯:JX

理念在介绍里面写的很详细,代码清晰,注释丰富,可读性很好,但只有文档没有实例。
比较传统的大块头框架,本质上来说还是一堆工具方法和对象的堆积,提供了很基本的模块化的开发方式,但没有模块间的依赖关系支持。

@toctan
toctan / youtube-dl.sh
Last active December 17, 2015 11:39
Download 3 videos concurrently using youtube-dl.
#!/bin/bash
i=0
while read LINE
do
(youtube-dl $LINE -o "%(title)s.%(ext)s") &
let i++
if (( $i % 3 == 0 )); then
wait # Limit to 3 concurrent subshells
@louisstow
louisstow / layers.html
Created May 20, 2013 06:06
Example of a game with 3 canvas layers.
<div id="stage">
<canvas id="ui-layer" width="480" height="320"></canvas>
<canvas id="game-layer" width="480" height="320"></canvas>
<canvas id="background-layer" width="480" height="320"></canvas>
</div>
<style>
#stage {
width: 480px;
height: 320px;
@wintercn
wintercn / HTMLLexicalParser.js
Last active August 5, 2019 11:16
HTML语法分析器模型
function StartTagToken(){
}
function EndTagToken(){
}
function Attribute(){
}