Skip to content

Instantly share code, notes, and snippets.

View kaleocheng's full-sized avatar
🦀

Kaleo kaleocheng

🦀
View GitHub Profile
@kaleocheng
kaleocheng / translate.go
Created September 25, 2017 08:15 — forked from hvoecking/translate.go
Golang reflection: traversing arbitrary structures
// 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
//
package valid
import (
"reflect"
)
const tagName = "valid"
func IsZero(x interface{}) bool {
return reflect.DeepEqual(x, reflect.Zero(reflect.TypeOf(x)).Interface())
@kaleocheng
kaleocheng / Makefile
Created December 26, 2017 06:01 — forked from prwhite/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
# 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
@kaleocheng
kaleocheng / Remove all git tags
Created December 28, 2017 06:18 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
#!/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]

Keybase proof

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: