Skip to content

Instantly share code, notes, and snippets.

View fundon's full-sized avatar
🎯
Focusing

Fangdun Tsai fundon

🎯
Focusing
View GitHub Profile
@fundon
fundon / some.sh
Created December 10, 2012 17:05 — forked from tj/some.sh
change terminal tab name on cd
function tabname {
printf "\e]1;$1\a"
}
cd() {
test $# -ne 0 && builtin cd "$*" || builtin cd
tabname $(basename $(pwd))
}
@fundon
fundon / gist:3808083
Created September 30, 2012 18:29 — forked from pithyless/gist:1208841
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

@fundon
fundon / tagged.css
Created September 10, 2012 17:38 — forked from csswizardry/tagged.css
Leaving tags in CSS files to find similar chunks of code
/*------------------------------------*\
$NAV
\*------------------------------------*/
/*
TAGS: ^lists ^navigation ^text
*/
/*
As per csswizardry.com/2011/09/the-nav-abstraction
*/
.nav{
@fundon
fundon / h5g
Created July 19, 2012 17:11 — forked from wintercn/h5g
HTML5 Canvas Game Template
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<!--允许全屏-->
<meta content="yes" name="apple-mobile-web-app-capable"/>
<meta content="yes" name="apple-touch-fullscreen"/>
<!--禁止电话号码和邮箱识别-->
@fundon
fundon / gist:2852614
Created June 1, 2012 14:43 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@fundon
fundon / portable-node.md
Created May 27, 2012 14:39 — forked from rhiokim/portable-node.md
Tips for Writing Portable Node.js Code

Tips for Writing Portable Node.js Code

(This is the kind of thing I should put on my hypothetical blog.)

I'm a Node.js user... on Windows. (Gasp!) And here are some of the issues I face every day:

Easy to Fix

In order of most-violated to least-violated:

foo {
animation-name: spin;
animation-duration: 3s;
animation-timing-function: ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(10,start | end) | cubic-bezier(<number>, <number>, <number>, <number>);
animation-delay: 3s;
animation-iteration-count: infinite | 10;
animation-direction: alternate | normal;
animation-fill-mode: forward | backwards | both | none;
animation-play-state: running | paused;
}
@fundon
fundon / sqlpostgres.vim
Created May 23, 2012 02:52 — forked from kmatt/sqlpostgres.vim
SQL postgres vim syntax file
" Vim syntax file
" Language: SQL, PGSQL (postgres 9.1)
" Last Change: 2012 May 21st
" Maintainer: Grégoire Hubert <greg DOT hubert AT gmail DOT com>
" Based on the work of Paul Moore <pf_moore AT yahoo.co.uk>
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
@fundon
fundon / count_utf8.js
Created May 21, 2012 14:39 — forked from frne/count_utf8.js
Function to count bytes of a string (UTF8)
/**
* Function to fix native charCodeAt()
*
* Now, we can use fixedCharCodeAt("foo€", 3); for multibyte (non-bmp) chars too.
*
* @access public
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/charCodeAt
* @note If you hit a non-bmp surrogate, the function will return false
* @param str String Mixed string to get charcodes
* @param idx Integer Position of the char to get
@fundon
fundon / [JS]GetUTF8CodePoint
Created May 21, 2012 14:39
Get UTF-8 Codepoint from UTF-8 Hex-Num array in JavaScript
function getCodePoint(array) {
/*-----------------------------------------------------------------------------------------
[UCS-2 (UCS-4)] [bit pattern] [1st byte] [2nd byte] [3rd byte] [4th byte]
U+ 0000.. U+007F 00000000-0xxxxxxx 0xxxxxxx
U+ 0080.. U+07FF 00000xxx-xxyyyyyy 110xxxxx 10yyyyyy
U+ 0800.. U+FFFF xxxxyyyy-yyzzzzzz 1110xxxx 10yyyyyy 10zzzzzz
U+10000..U+1FFFFF 00000000-000wwwxx 11110www 10xxxxxx 10yyyyyy 10zzzzzz
-xxxxyyyy-yyzzzzzzz
------------------------------------------------------------------------------------------*/