Skip to content

Instantly share code, notes, and snippets.

View tangzhen's full-sized avatar
🎯
Focusing

Zhen Tang tangzhen

🎯
Focusing
  • Chengdu, Sichuan, China
View GitHub Profile
@tangzhen
tangzhen / Xcode.txt
Created June 28, 2014 10:13 — forked from foundry/.gitignore
git ignore file for Xcode
#########################
# update 4 June 2014
# ignore Pods folder and Podfile.lock
#########################
Pods
Podfile.lock
#########################
# https://gist.github.com/foundry/4383910
@tangzhen
tangzhen / mirror.sh
Created June 29, 2014 10:16
Switch NodeJS and Ruby Gem to China Taobao mirror
# switch npm
echo '\n#alias for cnpm\nalias cnpm="npm --registry=registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=http://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
#switch Ruby gem
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
@tangzhen
tangzhen / cleanup_all_gemsets.sh
Created July 1, 2014 13:22
Cleanup all gem sets
#!/bin/sh
echo "NB! This process could be too destructive sometimes and you may need to run 'bundle' command from your project directory."
echo "Do you want to cleanup all gemsets?"
read -p "(anything other than 'yes' will cancel) > " ANSWER
if [[ $ANSWER != "yes" ]]
then
echo "Phew...\nMay be another day."
else
@tangzhen
tangzhen / js-comment-header.js
Created July 18, 2014 07:00
The Javascript Comment Header
//**********************************************************
// Assignment: Program 2
// Account: (Enter your cs110 account number here)
//
// Author: (Enter your full name here)
//
// Completion time: (Enter the total number of hours you
// spent on the assignment)
//
// Honor Code: I pledge that this program represents my own
function Get-IniContent ($filePath)
{
$ini = @{}
$content = Get-Content $filePath
if ( $content -match "^\[(.+)\]" ) {
switch -regex -file $FilePath
{
"^\[(.+)\]" # Section
{
$section = $matches[1]
@tangzhen
tangzhen / useminPrepare.js
Created November 19, 2014 10:02
Add additional options into concat&uglify when use usemin
'use strict';
module.exports = {
html: '<%= config.web %>/index.html',
options: {
dest: '<%= config.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs']
@tangzhen
tangzhen / promise-loop.js
Last active September 5, 2021 14:00
javascript promise while loop
'use strict';
// ref: http://blog.victorquinn.com/javascript-promise-while-loop
var q = require('bluebird');
var promiseWhile = function (condition, action) {
var resolver = q.defer();
var loop = function () {
diff --git a/cordova-lib/src/cordova/platformsConfig.json b/cordova-lib/src/cordova/platformsConfig.json
index d8f85d0..4aa53e8 100644
--- a/cordova-lib/src/cordova/platformsConfig.json
+++ b/cordova-lib/src/cordova/platformsConfig.json
@@ -5,6 +5,12 @@
"url": "https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git",
"version": "3.7.0"
},
+ "osx" : {
+ "hostos" : ["darwin"],
@tangzhen
tangzhen / atom_package.txt
Last active August 29, 2015 14:17
atom package
apm install angularjs
apm install atom-alignment
apm install autocomplete-plus
apm install autoprefixer
apm install change-case
apm install color-picker
apm install csscomb
apm install csslint
apm install editor-stats
apm install editorconfig
@tangzhen
tangzhen / ServerUtil.java
Last active November 16, 2015 14:12 — forked from dominicbartl/ServerUtil.java
Inject dynamic host IP address in with Gradle
private static final String HOST_EMULATOR = "10.0.2.2";
private static final String HOST_PRODUCTION = "example.com";
public static String getHost() {
if (BuildConfig.DEBUG) {
return (Build.PRODUCT).contains("sdk") ? HOST_EMULATOR : BuildConfig.LOCAL_IP;
}
return HOST_PRODUCTION;
}