Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Quantitative change, Then Qualitative change

PMST colourful987

💭
Quantitative change, Then Qualitative change
  • Bytedance
  • Hangzhou
View GitHub Profile
@colourful987
colourful987 / get_file_time.sh
Last active Jul 15, 2019
How to get file modify time or access time in OSX
View get_file_time.sh
stat -f "Access (atime): %Sa%nModify (mtime): %Sm%nChange (ctime): %Sc%nBirth (Btime): %SB" Screenshot_FFFDA56C-3018-4EA8-8A8B-2589E9C47865.jpg
date -r Screenshot_FFFDA56C-3018-4EA8-8A8B-2589E9C47865.jpg +%Y-%m-%d-%H:%M:%S
@colourful987
colourful987 / struct_initializer.m
Last active May 30, 2017
三种初始化结构体的方式
View struct_initializer.m
struct student{
const char *name;
int age;
char tag;
};
int main(int argc, const char * argv[]) {
// 方式一
struct student st_student1 = {"Alan",10,'1'};
View swift-talk-episode1-networking.swift
import Foundation
let url = URL(string:"http://localhost/test1.json")!
typealias JSONDictionary = [String:AnyObject]
// 资源的链接 & 解析闭包
struct Resource<A>{
View OPP-Logger.swift
// 面向协议的日志输出
enum LogLevel: Int {
case verbose = 1
case debug = 2
case info = 3
case warning = 4
case error = 5
}
@colourful987
colourful987 / defineSkills.c
Last active Sep 16, 2016
#Define Little Skills
View defineSkills.c
/**
引自 Pointers on C 一书
1. 在调用宏时,首先对参数进行检查,查看是否包含任何由 `#define` 定义的符号,如果是,这些符号首先被替换掉
2. 替换文本随后被插入到程序中原来文本的位置,对于宏,参数名被它们的值所替换。
3. 最后,再次对结果文本进行扫描,看看它是否包含了任何由#define 定义的符号,如果是,就重复上述处理步骤。
宏参数和#define 定义可以包含其他#define 定义的符号,但是,宏不可以出现递归!
当预处理器搜索#define定义的符号时,字符串常量的内容不被检查,如果想把宏参数插入到字符串常量中,有以下几种方式:
*/
@colourful987
colourful987 / Pokemon.swift
Last active Sep 16, 2016
Seven Demo For Explaining Swift Closures Capture Semantics
View Pokemon.swift
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
class Pokemon :CustomStringConvertible{
let name: String
@colourful987
colourful987 / Decoding_JSON_In_Swift.swift
Last active Aug 29, 2016
Decoding JSON In Swift (一)
View Decoding_JSON_In_Swift.swift
// From Soroush Khanlou ,URL: [Decoding JSON in Swift](http://khanlou.com/2016/04/decoding-json/)
import Foundation
struct ParserError:Error{
let message:String
}
struct Parser {