Skip to content

Instantly share code, notes, and snippets.

View poying's full-sized avatar
🏠
I may be slow to respond.

Po-Ying Chen poying

🏠
I may be slow to respond.
View GitHub Profile
golden-ratio-value = 1.618
golden-ratio(value)
value * golden-ratio-value
golden-ratio-font(fontSize, contentWidth, args...)
font-size: fontSize
golden-ratio-line-height: fontSize contentWidth
if length(args) > 0
Edittor.registerPragraphType('h1', new Editor.ParagraphType());
// ...
Edittor.registerButton('link', new Editor.Button());
// ...
var options = {
selector: '#editor',
paragraphTypes: ['h1'],
buttons: ['link']
var promisfy = function (fn, ctx) {
return function () {
var args = arguments;
return new Promise(function (resolve, reject) {
var cb = function () {
var err = Array.prototype.shift.call(arguments);
if (err) {
reject(err);
} else {
random_animal() {
local animals='🐶🐺🐋🐹🐰🐷🐼🐳'
echo ${animals:$((RANDOM % ${#animals})):1}
}
PROMPT='%{$fg_bold[green]%}$(nodejs_prompt_info)%{$fg_bold[red]%} › %{$fg[cyan]%}%{$fg_bold[cyan]%}$(git_prompt_info)%{$reset_color%}'
RPROMPT='%{$fg_bold[cyan]%}%c%{$reset_color%} $(random_animal) '
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
<?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">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
Array.prototype.filter = Array.prototype.filter
|| function (fn) {
var item;
var clone = this.slice();
var done = {};
clone.push(done);
while ((item = clone.shift()) !== done) {
if (fn(item)) clone.push(item);
}
return clone;
@poying
poying / Makefile
Last active August 29, 2015 14:00
jade, stylus
NM = ./node_modules
JADE = $(NM)/.bin/jade
STYLUS = $(NM)/.bin/stylus
SERVER = $(NM)/.bin/http-server
SOURCE = ./src
PUBLIC = ./public
# jade
JADE_FILES := $(wildcard $(SOURCE)/*.jade)
@poying
poying / gist:fd3de57df774a1dbea7d
Last active August 29, 2015 14:00
通用公共不枉死聲明 General Public Not Unnecessary Death Declaration (GPNUDD) 版本 1.0

本人在此公開嚴正聲明:

本人樂觀開朗,身體健康,無任何使我困擾之慢性病或心理疾病,故覺不可能做出任何看似自殺之行為。 本人從無睡眠方面困擾,故不需服用安眠藥。 本人不酗酒亦不吸毒,也沒有濫用藥物習慣,服食藥物皆恪遵醫師指示。 本人覺不會接近下列地點--

  1. 開放性水域或無救生員之游泳池。
  2. 有高壓、危險氣體,或密閉式未經抽氣處理之地下室、蓄水池、水桶、地下道等處。
  3. 無安全防護措施之任何高處。
  4. 合施工地點(拆政府除外),包括製作消波塊之工地。
{
"env": {
"browser": true,
"node": true,
"amd": true
},
"rules": {
"no-console": 2,
"no-comma-dangle": 2,
@poying
poying / cli.js
Last active August 29, 2015 14:04
repl.on('line', function (line) {
prettyRedis.lock()
.then(prettyRedis.exec.bind(prettyRedis, line))
.then(prettyRedis.prettify)
.then(prettyRedis.print(' %s'))
.then(prettyRedis.unlock.bind(prettyRedis));
});
repl.on('error', function () {
// print error