Skip to content

Instantly share code, notes, and snippets.

# Uncrustify 0.60
newlines = auto
input_tab_size = 4
output_tab_size = 4
string_escape_char = 92
string_escape_char2 = 0
tok_split_gte = false
utf8_bom = ignore
utf8_byte = false
utf8_force = false
@tedzhou
tedzhou / useful-command.md
Last active August 29, 2015 14:12
useful commands collection

mac

hide dock in mac

just set a really long timer for autohide and show.

defaults write com.apple.dock autohide-time-modifier -int 100; killall Dock

reset dock by defaults delete com.apple.dock autohide-time-modifier; killall Dock

git

modify a local file which do not want to commit

@tedzhou
tedzhou / 设置"Perform Single-Object Prelink“导致编译失败.md
Last active August 29, 2015 14:04
设置"Perform Single-Object Prelink“导致编译失败
@tedzhou
tedzhou / libter2SetValue
Created June 11, 2014 05:32
为mac automator写的把词法定义的的字典改成用setValue的方式
#!/usr/bin/env node
var stdin = process.stdin,
stdout = process.stdout;
inputChunks = [];
var reg = /(.*?)\s?=?\s?@\{([\s\S]*)\}/;
stdin.resume();
stdin.setEncoding('utf8');
@tedzhou
tedzhou / ocFileCombine
Created May 27, 2014 04:08
合并同一目录的文件,简单处理依赖
#!/usr/bin/env node
var fs = require('fs');
var root = process.argv[2] || __dirname;
var reg = /#import "(.*?.).h"/;
function getAllFiles() {
var dictionaries = {};
var files = fs.readdirSync(root);
files.forEach(function (dictionary) {
@tedzhou
tedzhou / ioPool_.idea_.name
Created April 16, 2014 05:36
抓数据的工具集
ioPool
@tedzhou
tedzhou / 我要学OC:objective-c的内存管理.md
Last active January 29, 2017 07:06
我要学OC:objective-c的内存管理.md

卤煮刚被web大潮淘汰到ios,当听说写oc要手动释放内存的时候如丧考妣,不过幸运的是ARC来了,妈妈再也不用担心我内存泄漏了。不过根据卤煮多年开发经验,和内存相关的不可能没有坑,开心之余还是得了解下oc是怎么搞内存的。

[TOC]

MRR和retainCount

OC对象都有一个属性 retainCount 表明这个对象还有几个引用, 当retainCount为0, 说明这个对象没人用了,runtime就会回收掉。而所谓的内存泄漏就是明明没人用了,retainCount却不是0,runtime没有回收掉这个对象。

retain and release

@tedzhou
tedzhou / wrapQuote.js
Created June 9, 2013 08:00
wrap regex key words
/**
* Created with IntelliJ IDEA.
* User: ted
* Date: 13-6-9
* Time: 下午3:59
* To change this template use File | Settings | File Templates.
*/
// copy from canjs
// 把正则的敏感词转起来