Skip to content

Instantly share code, notes, and snippets.

View yorkxin's full-sized avatar
〽️

Yu-Cheng Chuang yorkxin

〽️
View GitHub Profile
@yorkxin
yorkxin / gist:221439
Created October 29, 2009 13:20
my DefaultFontFallbacks.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- ATSUI-compatible preferred fallback -->
<dict>
<!-- default ordered fallback list - fallback entity has to be PostScript name -->
<key>default</key>
<array>
<string>LucidaGrande</string> <!-- MAKE sure this matches the kCTFontSystemFontType in CTFontDescriptorCreateForUIType() & TDescriptorSourceImp::CreateDefaultDescriptor()! -->
<string>AppleSymbolsFB</string>
@yorkxin
yorkxin / gist:805284
Created February 1, 2011 02:08
sample code of supporting to S3's GET link with response-* params
# see https://github.com/rightscale/right_aws/pull/47 for more details
# Traditional way, without headers and response-* params
s3instance.get_link('bucket_name', 'key/song.mp3', 86400)
#=> https://bucket_name.s3.amazonaws.com:443/key%2Fsong.mp3?Signature=vIh5...&Expires=1296611902&AWSAccessKeyId=AK...
# To generate url with response-* params, headers parameter must be specified,
# and response-* params are in hash style
s3instance.get_link('bucket_name', 'key/song.mp3', 86400,
{}, # empty additional headers
@yorkxin
yorkxin / wordpressdotcom.rb
Created November 25, 2011 18:29
Wordpress.com (XML export) to Octopress importer. See http://git.io/x8yapw for change notes.
# coding: utf-8
# Original File: https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# Modified by Yu-Cheng Chuang <ducksteven@gmail.com>
# Licensed under MIT License (same as the original file)
# This version of wordpressdotcom.rb is compatible
# with the real-world Wordpress.com export file, which:
#
# - Makes paragraphs (<p>) and line breaks (<br>)
@yorkxin
yorkxin / yaci.zsh-theme
Created December 20, 2011 06:46
My ZSH Theme
# depends on oh-my-zsh
# forked from macovsky-ruby theme
local return_code="%(?..%{$bg[red]%}%{$fg[black]%}=%?%{$reset_color%})"
function rvm_prompt_info {
echo "$ZSH_THEME_RVM_PROMPT_PREFIX$(~/.rvm/bin/rvm-prompt i v g)$ZSH_THEME_RVM_PROMPT_SUFFIX"
}
function git_prompt_status_full {
@yorkxin
yorkxin / DeafultKeyBinding.dict
Created December 23, 2011 01:35
Mac OS X Function-Key Hack
{
/* home */
"\UF729" = "moveToBeginningOfLine:";
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* end */
"\UF72B" = "moveToEndOfLine:";
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
/* page up/down */
@yorkxin
yorkxin / Readme.markdown
Created March 9, 2012 16:10
Test failed for Ruby 1.9.2-p320 (compiled with Clang 3.1)
@yorkxin
yorkxin / readme.md
Created April 4, 2012 07:52
Build GitX (R)

GitX (R)

brew install cmake
brew link cmake
brew install libgit2

git clone git://github.com/rowanj/gitx.git
cd gitx

git submodule init

@yorkxin
yorkxin / avoid-jquery-when-possible.md
Created July 7, 2012 13:04
Avoid jQuery When Possible

Avoid jQuery When Possible

jQuery does good jobs when you're dealing with browser compatibility. But we're living in an age that fewer and fewer people use old-school browsers such as IE <= 7. With the growing of DOM APIs in modern browsers (including IE 8), most functions that jQuery provides are built-in natively.

When targeting only modern browsers, it is better to avoid using jQuery's backward-compatible features. Instead, use the native DOM API, which will make your web page run much faster than you might think (native C / C++ implementaion v.s. JavaScript).

If you're making a web page for iOS (e.g. UIWebView), you should use native DOM APIs because mobile Safari is not that old-school web browser; it supports lots of native DOM APIs.

If you're making a Chrome Extension, you should always use native APIs, not only because Chrome has almost the latest DOM APIs available, but this can also avoid performance issue and unnecessary memory occupation (each jQuery-driven extension needs a separate

@yorkxin
yorkxin / KeyBindings.json
Last active November 29, 2018 20:40
My Sublime Text 2 Config
/* Default (OS X).sublime-keymap */
/* Key Bindings - User */
[
{ "keys": ["ctrl+shift+."], "command": "erb", "context":
[
{
"key": "selector",
"operator": "equal",
"operand": "text.html.ruby, text.haml, source.yaml, source.css, source.scss, source.js, source.coffee"
}
@yorkxin
yorkxin / README.md
Created December 14, 2012 07:45
Notes on Paul Irish's "Things I learned from the jQuery source" casts.

Notes on Paul Irish's "Things I learned from the jQuery source" casts

I watched these videos on 2012/12/14. Today's jQuery version is 1.8.3. So there might be some differences from the original video. I've briefly noted some of the differences between what described in the video and the current stable release. Most code he desribed can be found easily in speed/jquery-basic.js (1.4.2).

Episode 1

2010-06-14 (jQuery 1.4.1)