Skip to content

Instantly share code, notes, and snippets.

View sorrycc's full-sized avatar
🌻
Working on UmiJS

chencheng (云谦) sorrycc

🌻
Working on UmiJS
View GitHub Profile
@sorrycc
sorrycc / CSS Overflow Test Script
Created February 27, 2011 08:10
CSS Overflow Test Script
/**
* CSS Overflow Test Script
* @author sorrycc@gmail.com, @chenchengpro
* @doc http://www.chencheng.org/
*/
(function() {
// Text
@sorrycc
sorrycc / browserinfo.js
Created March 29, 2011 05:58
Two way to get browser type[ and version]
var getBrowserInfo = function() {
// Ref: http://www.useragentstring.com/pages/useragentstring.php
var token = [ // 顺序有关
"Opera", // 某些版本会伪装成 MSIE, Firefox
"Chrome", // 某些版本会伪装成 Safari
"Safari", // 某些版本会伪装成 Firefox
"MSIE 6",
"MSIE 7",
"MSIE 8",
"MSIE 9",
@sorrycc
sorrycc / gist:939575
Created April 24, 2011 14:32
nignx init.d file
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu <=9.10.
# Description: nginx init.d dash script for Ubuntu <=9.10.
### END INIT INFO
@sorrycc
sorrycc / gist:1075537
Created July 11, 2011 08:40
scrollbar in pre style
/* Thanks Flyosity! */
/* Ref: http://vunction.com/blog/post/node-and-oauth-and-flickr-oh-my */
pre::-webkit-scrollbar {
width: 8px;
height: 6px;
}
pre::-webkit-scrollbar-button:start:decrement, pre::-webkit-scrollbar-button:end:increment {
display: none;
@sorrycc
sorrycc / gist:1244747
Created September 27, 2011 10:07
auto load memo for trade.taobao.com
(function() {
var count = 0;
if (!KISSY.one('#J_ListTable')) return;
KISSY.one('#J_ListTable').all('tbody.order').each(function(el, i) {
var oid = el.getDOMNode().id;
if (!oid) return;
if (el.one('a.J_MemoFlag').one('img').getDOMNode().src.indexOf('op_memo_0') > -1) {
return;
}
KISSY.all('#J_Slide img').attr('src', 'http://img03.taobaocdn.com/tps/i3/T1ci8_XhXwXXXXXXXX-490-170.png');
'mail.google.com': function() {
var h = new Date().getHours();
if (h > 10 && h < 18) {
document.body.innerHTML = '<div style="font:60px/1.5 arial;color:gray;text-align:center;margin-top:200px;">工作时间别老看邮件.</div>';
}
}
@sorrycc
sorrycc / gist:1422427
Created December 2, 2011 09:00
combo
var A = ['a1', 'a2', 'a3'];
var B = ['b1', 'b2'];
var C = ['c1', 'c2', 'c3', 'c4', 'c5'];
function combo(a, b) {
var ret = [];
var n = a.length;
var m = b.length;
@sorrycc
sorrycc / upload_directory_to_xunlei_lixian.sh
Created February 24, 2012 09:24
上传目录下的所有 torrent 文件到迅雷离线
#
# @fileoverview 上传目录下的所有 torrent 文件到迅雷离线.
# @author ChenCheng <sorrycc@gmail.com>
# @ref https://github.com/iambus/xunlei-lixian
#
tmpdir="path/to/tmp/directory";
script="path/to/xunlei-lixian/lixian_cli.py"
if [ ! -d "$tmpdir" ]; then
@sorrycc
sorrycc / st2icon.sh
Created March 18, 2012 08:03
Shell script to replace the Sublime Text 2 icon with a custom icon
#!/bin/bash
# Change this to the path to your icns file
ICON="$HOME/Sublime Text 2.icns"
cp -f "$ICON" "/Applications/Sublime Text 2.app"/Contents/Resources
cp -r "/Applications/Sublime Text 2.app" "/Applications/Sublime Text 2 copy.app"
rm -rf "/Applications/Sublime Text 2.app"
mv "/Applications/Sublime Text 2 copy.app" "/Applications/Sublime Text 2.app"