This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
// NSJSONSerialization(iOS5新增) 类似的第三方库有:SBJSON、TouchJSON、YAJL、JSONKit、NextiveJson。 | |
// 可以将JSON数据转为Foundation对象,一般是 NSDictionary 或者 NSArray,或者将Foundation对象转换为JSON数据 | |
// NSJSONReadingOptions | |
// MutableContainers:转换的来的 NSArray 或 NSDictionary 是 mutable 的 | |
// MutableLeaves:转换来的对象中,叶子节点的 NSString 是 mutable 的 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" | |
// Enum 类型的名称和成员值都应当以大写开头 | |
enum status{ | |
case ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" | |
var names = ["Chris", "Alex", "Ewa", "Barry", "Daniella"] | |
// 普通函数 | |
func desc(s1 : String, s2 : String) -> Bool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
var str = "Hello, playground" | |
// 函数和返回值 | |
func getUserName(id: Int) -> String { | |
return "xxy"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 第一步,找出所有库所在的行号 | |
cat all_databases.sql |grep -n "Current Database" | |
#返回 | |
422:-- Current Database: `data_platform` | |
8094:-- Current Database: `mysql` | |
13013:-- Current Database: `test` | |
13045:-- Current Database: `test_insert` | |
13085:-- Current Database: `test_l5` | |
# 第二步,确认要移除的库:mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ATTENTION PLEASE! | |
# NOTE BY @riwazp7 | |
# Note for future visitors of this gist: Mac OS has Apache Benchmark by default ab --help | |
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz | |
tar -xzf libtool-2.4.2.tar.gz | |
cd libtool-2.4.2 | |
./configure && make && sudo make install | |
# brew install 'https://raw.github.com/simonair/homebrew-dupes/e5177ef4fc82ae5246842e5a544124722c9e975b/ab.rb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update aptitude | |
sudo -s | |
apt-get update | |
apt-get install libpcre3-dev libssl-dev # openssl | |
# Download Tengine | |
wget http://tengine.taobao.org/download/tengine-2.1.0.tar.gz | |
tar zxvf tengine-2.1.0.tar.gz | |
cd tengine-2.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add following towards bottom | |
``` | |
### IMPROVE SYSTEM MEMORY MANAGEMENT ### | |
# Increase size of file handles and inode cache | |
fs.file-max = 2097152 | |
# Do less swapping | |
vm.swappiness = 10 | |
vm.dirty_ratio = 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -s | |
cd /opt | |
git clone https://github.com/nicolasff/phpredis.git | |
cd phpredis | |
phpize | |
./configure #--enable-redis-igbinary | |
make && make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 个性化日期显示 | |
* @static | |
* @access public | |
* @param datetime $times 日期 | |
* @return string 返回大致日期 | |
* @example 示例 ueTime('') | |
* @author http://segmentfault.com/q/1010000000650101 | |
*/ |