Skip to content

Instantly share code, notes, and snippets.

View towry's full-sized avatar
🎯
Focusing

Towry Wang towry

🎯
Focusing
  • Shanghai, China
View GitHub Profile
@towry
towry / ioslocaleidentifiers.csv
Created July 17, 2017 05:32 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@towry
towry / date_from_string.swift
Created July 17, 2017 05:52
convert date string into date in swift.
//: Playground - noun: a place where people can play
import AppKit
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
dateFormatter.timeStyle = .none
let dateStr = "2017-10-12"
@towry
towry / context.rb
Last active July 21, 2017 07:33
describe the DCI(Data, context, interaction) architecture in Ruby.
require_relative "customer"
require_relative "user"
# context bind role to object.
# by using the extend method in ruby.
# now the data object has some behaviors that get from the role class(Customer).
class Context
def initialize(user, book)
@customer, @book = user, book
@customer.extend(Customer)
@towry
towry / .ackrc
Created September 4, 2017 02:19 — forked from kevinold/.ackrc
#ack is a tool like grep, designed for programmers with large trees of heterogeneous source code
#to install ack, see http://betterthangrep.com/
#to use ack, launch terminal (mac osx) and type 'ack <some_keywords>'
#ack will search all files in the current directory & sub-directories
#here's how I have my config file setup. this file is located on mac osx here
# ~/.ackrc
# Always sort the files
@towry
towry / TestableJavaScript.md
Created September 11, 2017 13:09 — forked from jbranchaud/TestableJavaScript.md
Resources on writing testable JavaScript

Testable JavaScript Resources

Testing JavaScript isn't just a thing you can read about in children's fairy tales.

This is just a scratch pad of everything I find. As the really good resources start to float to the top, I'll transition them to a more permanent GitHub repo.

General

@towry
towry / rust_lifetime.md
Created November 9, 2017 01:06
rust lifetime.

Lifetime explained

fn main() {
    let x = "hi";   // lifetime a.
    let e;       // e should have a lifetime a.

    {
        let y = "you";   // lifetime b.
        e = check(&x, &y); // here we returned lifetime b.
@towry
towry / playground-example.swift
Last active January 5, 2018 08:50
How to run the code in swift in infinite mode.
import PlaygroundSupport
public func playgroundShouldContinueIndefinitely() {
PlaygroundPage.current.needsInfiniteExecution = true
}
@towry
towry / 详细设计文档编写规范
Created March 1, 2018 01:57 — forked from stableShip/详细设计文档编写规范
详细设计文档编写规范
## 一.引言
### 1. 编写目的(阐明编写详细设计说明书的目的,指明读者对象。)
### 2. 项目背景(应包括项目的来源和主管部门等。)
### 3. 定义(列出文档中用到的专门术语定义和缩写词的原意。)
### 4. 参考资料(列出这些资料的作者、标题、编号、发表日期、出版单位或资料来源,可包括:(1)项目的计划任务书,合同或批文;(2)项目开发计划;(3)需求规格说明书;(3)概要设计说明书;(4)测试计划(初稿);(5)用户操作手册(初稿);(5)文档所引用的其他资料、软件开发标准或规范。)
## 二.总体设计
### 1.需求概述
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.11.8/paper-full.min.js"></script>
<style id="jsbin-css">
.box {
width: 40px;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.text {
text-shadow:
-1px -1px 0 #D83024,