I hereby claim:
- I am kaleocheng on github.
- I am kaleocheng (https://keybase.io/kaleocheng) on keybase.
- I have a public key ASAfaSIXBDt-aEo0GGROqrTy0yXBIQOzVXySLAQWhylvHQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/swift | |
| # How to run: | |
| # swiftc dict.swift | |
| # ./dict hello | |
| import Foundation | |
| if (CommandLine.argc < 2) { | |
| print("Usage: dictionary word") | |
| }else{ | |
| let argument = CommandLine.arguments[1] |
| # Add the following 'help' target to your Makefile | |
| # And add help text after each target name starting with '\#\#' | |
| help: ## Show this help. | |
| @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | |
| # Everything below is an example | |
| target00: ## This message will show up when typing 'make help' | |
| @echo does nothing |
| package valid | |
| import ( | |
| "reflect" | |
| ) | |
| const tagName = "valid" | |
| func IsZero(x interface{}) bool { | |
| return reflect.DeepEqual(x, reflect.Zero(reflect.TypeOf(x)).Interface()) |
| // Traverses an arbitrary struct and translates all stings it encounters | |
| // | |
| // I haven't seen an example for reflection traversing an arbitrary struct, so | |
| // I want to share this with you. If you encounter any bugs or want to see | |
| // another example please comment. | |
| // | |
| // The MIT License (MIT) | |
| // | |
| // Copyright (c) 2014 Heye Vöcking | |
| // |
| # Add init repo | |
| mkdir hello | |
| cd hello | |
| git init | |
| echo "Hello World" > README.md | |
| git add . && git commit -m "Add README.md" | |
| # Add empty vendor dir | |
| git checkout --orphan vendor |
| // Equals check if two Resources are equals. | |
| func Equals(r1, r2 *Obj) bool { | |
| r1JSON, _ := json.Marshal(r1) | |
| r2JSON, _ := json.Marshal(r2) | |
| if string(r1JSON) == string(r2JSON) { | |
| return true | |
| } | |
| return false | |
| } |
| /** | |
| * MongoDB NodeJS Driver Production Connection Example | |
| * | |
| * Copyright (c) 2015 ObjectLabs Corporation | |
| * Distributed under the MIT license - http://opensource.org/licenses/MIT | |
| */ | |
| var MongoClient = require('mongodb').MongoClient; | |
| /** |
| #!/usr/bin/env python2 | |
| from SimpleHTTPServer import SimpleHTTPRequestHandler | |
| import BaseHTTPServer | |
| class CORSRequestHandler (SimpleHTTPRequestHandler): | |
| def end_headers (self): | |
| self.send_header('Access-Control-Allow-Origin', '*') | |
| SimpleHTTPRequestHandler.end_headers(self) | |
| if __name__ == '__main__': |