Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Veck Hsiao fbukevin

🏠
Working from home
Block or report user

Report or block fbukevin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View TimeTool.swift
import Foundation
class TimeTool {
func getCurrentTimeString() -> String {
let now = Date()
let df = DateFormatter()
df.dateFormat = "YYYY/MM/dd HH:mm:ss"
return df.string(from: now)
@fbukevin
fbukevin / loadText.swift
Created Dec 28, 2016
Load general text file in Swift 3
View loadText.swift
func loadText(file: String, handler: (String) -> Void){
if let path = Bundle.main.path(forResource: file, ofType: "txt") {
do {
let context = try String(contentsOfFile: path, encoding: .utf8)
handler(context)
} catch {
print(error.localizedDescription)
}
}
}
@fbukevin
fbukevin / loadJSON.swift
Created Dec 28, 2016
Load JSON file in Swift 3
View loadJSON.swift
func loadJSON(file: String, handler: (NSDictionary) -> Void){
if let path = Bundle.main.path(forResource: file, ofType: "json") {
do {
let jsonData = try NSData(contentsOfFile: path, options: NSData.ReadingOptions.mappedIfSafe)
do {
let json: NSDictionary = try JSONSerialization.jsonObject(with: jsonData as Data
, options: JSONSerialization.ReadingOptions.mutableContainers) as! NSDictionary
handler(json)
} catch {
print("Parse json failed")
@fbukevin
fbukevin / Procfile
Created Nov 23, 2016 — forked from mojodna/Procfile
Getting Kue working on Heroku
View Procfile
web: node app.js
worker: node consumer.js
@fbukevin
fbukevin / snap.animAlongPath.html
Last active Jan 22, 2016
Snap Plugin - Animate along path
View snap.animAlongPath.html
<script src="snap.svg-min.js"></script>
<script src="snap.tool.js"></script>
<svg id="snap_demo" width="640" height="480" xmlns="http://www.w3.org/2000/svg">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
<title>Layer 1</title>
<path id="svg_4" d="m229,96c0,0 -105,104 -105,104c0,0 97,124 97,124c0,0 139,-2 139,-2c0,0 69,-101 69,-101c0,0 -78,-124 -78,-124c0,0 -122,-1 -122,-1z" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="null" stroke-width="5" stroke="#edd7d7" fill="none"/>
<rect fill="none" stroke="#000000" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="232" y="278" width="1" height="0" id="svg_3"/>
<circle fill="#000000" stroke="#000000" stroke-width="5" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" cx="284" cy="96" r="6.7082" id="svg_9">
@fbukevin
fbukevin / snap.animAlongPath.js
Created Jan 22, 2016
Snap.svg plug - Animate along path
View snap.animAlongPath.js
Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
var elproto = Element.prototype;
elproto.animateAlongPath = function (path, el, start, duration, easing) {
var callback = this;
el.transform('t0,0');
var len = Snap.path.getTotalLength(path),
elBB = el.getBBox(),
elCenter = {
x: elBB.x + (elBB.width / 2),
y: elBB.y + (elBB.height / 2),
View example1_nO2.s
main:
@ args = 0, pretend = 0, frame = 16
@ frame_needed = 1, uses_anonymous_args = 0
push {r7, lr}
sub sp, sp, #16
add r7, sp, #0
movs r3, #10
str r3, [r7, #4]
movs r3, #12
str r3, [r7, #8]
View example1_O2.s
main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
movs r0, #22
bx lr
.size main, .-main
.text
.align 2
.global add
You can’t perform that action at this time.