Skip to content

Instantly share code, notes, and snippets.

View mosluce's full-sized avatar

mosluce mosluce

View GitHub Profile
@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 / auth-form-view-model.ts
Last active June 6, 2017 08:19
model 與 component 分開
export class AuthFormViewModel {
email: string;
password: string;
}
@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.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
using UnityEngine.Networking;
namespace Azure
{
public class Authentication
//
// GalleryTools.h
// Unity-iPhone
//
// Created by 默司 on 2017/5/9.
//
//
#import <Foundation/Foundation.h>
import UIKit
extension UIView {
@discardableResult func constraint(attribute attr1: NSLayoutAttribute, relatedBy: NSLayoutRelation = .equal, toItem: Any? = nil, attribute attr2: NSLayoutAttribute? = nil, multiplier: CGFloat = 1, constant: CGFloat = 0) -> NSLayoutConstraint {
self.translatesAutoresizingMaskIntoConstraints = false
let attr = attr2 ?? attr1
return NSLayoutConstraint(item: self, attribute: attr1, relatedBy: relatedBy, toItem: toItem, attribute: attr, multiplier: multiplier, constant: constant)
@mosluce
mosluce / 回呼.js
Last active May 3, 2017 14:20 — forked from matt0224/回呼
var Home = {
Box: function () {
this.color = 'black';
this.paint = function (value, cb) {
// delay 3 seconds.
//var now = new Date().getTime();
//while (new Date().getTime() < now + 3000) {
// /* do nothing */
//}
this.color = value;
.yt-live-chat-renderer-0 {
background: transparent;
}
.yt-live-chat-renderer {
height: 0;
padding: 0;
font-size: 0;
}
@mosluce
mosluce / VideoViewController.swift
Last active March 3, 2017 03:01
仿 Youtube 試做
//
// VideoViewController.swift
// SideMenuCALayerDemo
//
// Created by 默司 on 2017/3/1.
// Copyright © 2017年 默司. All rights reserved.
//
import UIKit
import AVFoundation