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 / Count lines of code in Xcode project
Created July 27, 2017 06:42 — forked from Tokuriku/Count lines of code in Xcode project
Count lines of code in SWIFT Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.swift" -print0 | xargs -0 wc -l
@tangzhen
tangzhen / optional.feature
Created July 10, 2016 01:18 — forked from basti1302/optional.feature
Use an optional parameter in Cucumber
Feature: Optional parameter
Scenario: Use an optional parameter
When I execute a step
When I execute a step with the optional parameter whatever
@tangzhen
tangzhen / ObjectMapper+Alamofire+RxSwift
Last active June 21, 2016 22:05 — forked from billwang1990/ObjectMapper+Alamofire+RxSwift
ObjectMapper+Alamofire+RxSwift
//
// RxAlamofireObjectMapper.swift
//
// Edit by TangZhen on 06/19/16.
// Forked from https://gist.github.com/billwang1990/a0e20919e7add7aafd8e
// Copyright © 2016 ztang.pub All rights reserved.
//
import Foundation
import Alamofire
@tangzhen
tangzhen / image.resize.in.github.flavored.markdown.md
Created February 28, 2016 10:59 — forked from uupaa/image.resize.in.github.flavored.markdown.md
image resize in github flavored markdown.

Image source

https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

Try resize it!

  • ![](https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png | width=100)
@tangzhen
tangzhen / better-nodejs-require-paths.md
Created January 10, 2016 04:12 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@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;
}
function Get-IniContent ($filePath)
{
$ini = @{}
$content = Get-Content $filePath
if ( $content -match "^\[(.+)\]" ) {
switch -regex -file $FilePath
{
"^\[(.+)\]" # Section
{
$section = $matches[1]
@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