Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Travis trawor

💭
I may be slow to respond.
Block or report user

Report or block trawor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1279953
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeNewsstandContentAvailability |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
@trawor
trawor / isMobileNumber_China
Created Sep 21, 2012
isMobileNumber_China.m
View isMobileNumber_China
- (BOOL)isMobileNumber:(NSString *)mobileNum
{
/**
* 手机号码
* 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
* 联通:130,131,132,152,155,156,185,186
* 电信:133,1349,153,180,189
*/
NSString * MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";
/**
@trawor
trawor / start.sh
Created Nov 23, 2012
SAV-Python 本地
View start.sh
#!/bin/bash
PATH_KVDB="/Users/Travis/Development/SAE/data/kvdb.txt";
PATH_STORAGE="/Users/Travis/Development/SAE/data/Storage";
clear;cd $1;echo "Start Project: $1"
dev_server.py index.wsgi --storage-path="${PATH_STORAGE}" --kvdb-file="${PATH_KVDB}" --mysql=root:111111@127.0.0.1:3306
@trawor
trawor / gist:5843485
Created Jun 23, 2013
获取国内手机号运营商
View gist:5843485
/** 获取国内手机号运营商
* @param phone 手机号
* @return `U`是联通,`M`是移动,`T`是电信
*/
+(NSString*)carrierOfPhone:(NSString*)phone{
if (phone.length>11) {
//去掉乱七八糟的字符
phone=[[phone componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"+- "]] componentsJoinedByString:@""];
//如果86开头 去掉
View tornado_debug.py
"""Demonstration of tornado web server with werkzeug interactive debugger.
Ron DuPlain <ron.duplain@gmail.com>
https://gist.github.com/rduplain/4983839
2013-02-19
* Python 2.7.3
* Tornado 2.4.1
* Werkzeug 0.8.3
@trawor
trawor / AVOSCloud-Beta.podspec
Last active Dec 30, 2015
AVOSCloud-Beta.podspec
View AVOSCloud-Beta.podspec
Pod::Spec.new do |s|
s.version = "999.99"
s.source = { :http => "https://download.avoscloud.com/sdk/iOS/release-beta/AVOSCloud.framework.zip"}
s.platform = :ios, '5.0'
s.name = "AVOSCloud"
s.summary = "AVOS Cloud iOS SDK for mobile backend."
s.homepage = "http://avoscloud.com"
@trawor
trawor / git_version.sh
Created Jun 21, 2013
每次编译把Git的提交次数作为小版本号
View git_version.sh
#Git 版本数
VERSION_NUMBER=`git rev-list head | sort | wc -l | awk '{print $1}'`
#VERSION_HASH=`git rev-list head | head -1`
echo $VERSION_NUMBER
#echo $VERSION_HASH
##加入版本号
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${VERSION_NUMBER}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
@trawor
trawor / iptables.sh
Last active Apr 17, 2019
Auto setup for zerotier
View iptables.sh
#!/bin/sh
NIC=
iptables -I FORWARD -i zt+ -j ACCEPT
iptables -I FORWARD -o zt+ -j ACCEPT
iptables -t nat -I POSTROUTING -o zt+ -j MASQUERADE
iptables -t nat -A POSTROUTING -o ${NIC} -j MASQUERADE
@trawor
trawor / turbo-qiniu.sh
Last active May 19, 2019
本脚本解决部分地区七牛上传速度慢的问题
View turbo-qiniu.sh
#!/bin/bash
#
# 通过对比 ping 响应时间,找到本机最快的上传ip
# Travis@fir.im
#
# 使用方法:
# sh -c "$(curl -sSL https://gist.githubusercontent.com/trawor/5dda140dee86836b8e60/raw/turbo-qiniu.sh)"
echo "# 这个脚本理论上可以帮你获取任意域名的最快速的IP"
echo "# 获取IP列表的服务由 17ce.com 提供, 非常感谢有这么好的免费服务!"
You can’t perform that action at this time.