(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/usr/bin/env ruby | |
# how to use? | |
# 1, input your your_api_key | |
# 2, make the file executable first: chmod +x post-commit | |
# 3, put the file in your_project/.git/hooks/ folder | |
require "git" | |
require 'net/http' | |
require 'json' |
echo sha, contributor, date, message > log.csv | |
git log --date=local --pretty=format:'%h, %an, %ad, "%s"' >> log.csv |
1, 插入空行 | |
新发现一个命令, 使用点(.)重复上一个命令,如果是编辑代码或其他文本,需要插入很多空行, | |
可以这样子:先用o打开一个空行,然后ESC,接着就可以用.来操作了。每一次点.会在当前行的下面打开一个空行,并且不会进入编辑模式。 | |
2, | |
ddp 交换光标所在行和其下紧邻的一行。 | |
3, | |
d$ 删除当前字符之后的所有字符(本行) |
~ 将光标下的字母改变大小写 | |
3~ 将光标位置开始的3个字母改变其大小写 | |
g~~ 改变当前行字母的大小写 | |
U 将可视模式下选择的字母全改成大写字母 | |
u 将可视模式下选择的字母全改成小写 |
fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int { | |
// Raw height and width of image | |
val (height: Int, width: Int) = options.run { outHeight to outWidth } | |
var inSampleSize = 1 | |
if (height > reqHeight || width > reqWidth) { | |
val halfHeight: Int = height / 2 | |
val halfWidth: Int = width / 2 |
1, 赖世雄英标,2周三遍。 | |
2, ESL 3~4个月。学习方法: | |
例如,针对职场人士工作的需要, | |
使用商业类的那三本教材最佳。试 拿Interview Questions Answered举例说明 如何最大限度地优化自己的学习流程: | |
A.首先不要看教材文本,花上两三 天时间,仔细地把全本书的音频听完。 放心,Jeff博士讲课非常细心,生词都一 个个拼写出来,绝对不用担心听不懂。 如果不是因为生词原因而听不懂,听的 时候绝对不要做别的事情,要拿出笔记 本,做好笔记。 | |
B.初步听完后,开始读教材,花个 3∼4天的时间,对照着笔记把教材文本 里面的生词短语之类的都搞定。 | |
C.之后开始进行跟读的练习,每天 跟读多少的量、多长时间要自己安排, 以能接受为准。 | |
跟读练习是我们这里的重头戏。我 | |
建议大家最好对教材全文跟读,不管是 | |
讲解还是单纯的课程录音,对形成你的 |
转自:https://www.zybuluo.com/MicroCai/note/64272 | |
本文名为《GCD 实现同步锁》,内容不止于锁。文章试图通过 GCD 同步锁的问题,尽量往外延伸扩展,以讲解更多 GCD 同步机制的内容。 | |
引语:线程安全问题 | |
如果一段代码所在的进程中有多个线程在同时运行,那么这些线程就有可能会同时运行这段代码。假如多个线程每次运行结果和单线程运行的结果是一样的,而且其他的变量的值也和预期的是一样的,就是线程安全的。或者说:一个类或者程序所提供的接口对于线程来说是原子操作或者多个线程之间的切换不会导致该接口的执行结果存在二义性,也就是说我们不用考虑同步的问题。 | |
由于可读写的全局变量及静态变量可以在不同线程修改,所以这两者也通常是引起线程安全问题的所在。在 Objective-C 中还包括属性和实例变量(实际上属性和实例变量本质上也可以看做类内的全局变量)。 | |
Objective-C 同步锁 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
In Terminal, run these commands: | |
cd [Project folder] | |
find . -name \*.m | xargs genstrings -o . |
class Thunder { } | |
class Fire { } | |
protocol Pokemon { | |
typealias PokemonType | |
func attack(move:PokemonType) | |
} | |
struct Pikachu: Pokemon { | |
typealias PokemonType = Thunder |