Skip to content

Instantly share code, notes, and snippets.

View mosluce's full-sized avatar

mosluce mosluce

View GitHub Profile
@mosluce
mosluce / ChatViewController.swift
Created June 2, 2017 07:01
抓取 Firebase 訊息列表
class ChatViewController: JSQMessagesViewController {
// 訊息資料
var messages = [[String: Any]]()
// 訊息記錄節點
var messageRef: FIRDatabaseReference!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
@mosluce
mosluce / auth-form-view-model.ts
Last active June 6, 2017 08:19
model 與 component 分開
export class AuthFormViewModel {
email: string;
password: string;
}
@mosluce
mosluce / 費氏.go
Last active June 13, 2017 08:03
go 練習題 : 閉包 - 費氏數列
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
a := 0
b := 0
@mosluce
mosluce / Dockerfile
Created June 27, 2017 06:13
jenkins installation - hello world
# folder jenkins
FROM jenkins:2.60.1
USER root
RUN apt-get update \
&& apt-get install -y sudo \
&& rm -rf /var/lib/apt/lists/*
RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers
#
pipeline {
agent {
docker {
image 'node:8.1.0'
args '-u root'
}
}
stages {
pipeline {
agent {
docker {
image 'node:8.1.0'
args '-u root'
}
}
stages {
stage('Clean') {
//
// API.swift
// KLCC-SIGNBOOK
//
// Created by 默司 on 2017/7/4.
// Copyright © 2017年 默司. All rights reserved.
//
import UIKit
import RxSwift
let disposeBag = DisposeBag()
// 模擬 indicator 顯示/隱藏狀態
let indicator = Variable(false)
// 按鈕
lazy var loginButton: UIButton = {
let button = UIButton(type: .system)
button.tintColor = UIColor.red
button.setTitle("登入", for: .normal)
let bag = DisposeBag()
var hello = Variable(1)
hello.value = 2
hello.value = 3
hello.value = 4
// subscribe => A => 4
hello.asObservable().subscribe(onNext: { (n) in
@mosluce
mosluce / DA.swift
Last active July 19, 2017 05:50
Dictionary & Array Extensions
import UIKit
extension Dictionary {
subscript(string key: Key) -> String? {
return self[key] as? String ?? nil
}
subscript(bool key: Key) -> Bool? {
return self[key] as? Bool ?? nil
}