Skip to content

Instantly share code, notes, and snippets.

View zfkun's full-sized avatar
🎯
Focusing

zfkun zfkun

🎯
Focusing
View GitHub Profile
@zfkun
zfkun / apple-touch-icon.html
Created June 17, 2014 15:44
apple touch icon
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- For the iPad mini and the first- and second-generation iPad on iOS ≤ 6: -->
<link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72x72.png">
<!-- For the iPad mini and the first- and second-generation iPad on iOS ≥ 7: -->
<link rel="apple-touch-icon" sizes="76x76" href="apple-touch-icon-76x76.png">
<!-- For iPhone with high-resolution Retina display running iOS ≤ 6: -->
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">
<!-- For the iPad mini and the first- and second-generation iPad on iOS ≤ 6: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png">
<!-- For the iPad mini and the first- and second-generation iPad on iOS ≥ 7: -->
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="apple-touch-icon-76x76-precomposed.png">
<!-- For iPhone with high-resolution Retina display running iOS ≤ 6: -->
@zfkun
zfkun / moneyFormat.js
Created May 30, 2014 05:55
number to money style
define( function ( require, exports, module ) {
/**
* 货币数字格式化
* 将数字整数部分按3位分组加逗号格式化
*
* @example
* ```javascript
* var money = 123456789.1234567;
* var moneyFormated = toMoney( money );
@zfkun
zfkun / uninstall_nodejs
Created May 28, 2014 13:16
uninstall nodejs installed from pkg (Mac OSX)
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
| while read i; do
sudo rm /usr/local/${i}
done
sudo rm -rf /usr/local/bin/node \
/usr/local/lib/node_modules \
/var/db/receipts/org.nodejs.*
@zfkun
zfkun / setCursorTo.js
Last active August 29, 2015 13:59
cursor position setting
/**
* @file 简易光标定位
* @author zfkun(zfkun@msn.com)
*/
/**
* 简易光标定位
*
* @param node {(HTMLTextAreaElement | HTMLInputElement)} `TextArea`或`Input`元素
* @param index {number=} 定位位置,不传则定位到末尾
@zfkun
zfkun / ansi_escape_code.md
Last active May 5, 2019 10:10
ANSI Escape Code

ANSI Escape Code

给终端文字加点颜色和特效 (来自 http://mozillazg.com/)

文字特效相关的字符格式是:ESC[#;#;....;#m ,其中 # 的取值见下表:

# 的值 功能 python 代码 截图
00 或 0 正常显示 '\033[00m' + 'hello' + '\033[0;39m'
@treelite
treelite / pre-commit.sh
Last active August 29, 2015 13:57
git pre-commit hook
#!/bin/bash
#
# path: .git/hooks/pre-commit
echo "\n\x1B[33mCommit checking ...\x1B[0m\n"
npm test
exitCode=$?
if [ $exitCode -ne 0 ]
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@zfkun
zfkun / repeat.js
Last active December 27, 2015 17:59
create a repeat string by a string.
define(function() {
/**
* create a repeat string by a string
*
* @param {string} str target string
* @param {number} count repeat count
* @return {string}
*/
function repeat( str, count ) {
@zfkun
zfkun / audio_android.html
Last active December 25, 2015 16:08
HTML5 Audio API test for Android & IOS
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>audio test</title>
<style>
p { font-weight: bold; }
span { color: red; }
button { width: 100px; height: 30px; }
audio { display: block; margin: 5px 0; }