Skip to content

Instantly share code, notes, and snippets.

View NicholasTD07's full-sized avatar

Nicholas T. NicholasTD07

View GitHub Profile
@NicholasTD07
NicholasTD07 / iOS-UI-in-code-with-SnapKit.swift
Last active August 27, 2015 09:07
Doing iOS UI in code with SnapKit
import UIKit
import SnapKit
class SomeViewController: UIViewController {
var addButton = UIButton()
var helloWorldLabel = UILabel()
override func viewDidLoad() {
let superView = view
let views = [
// Try this in 32bit and 64bit iOS Simulator.
// In 32bit one, both tests pass.
// In 64bit one, - (void)testStubWorksForYES fails.
// Test support
#import <XCTest/XCTest.h>
#define MOCKITO_SHORTHAND
#import <OCMockito/OCMockito.h>
@NicholasTD07
NicholasTD07 / vundle-with-bootstrap.vim
Created January 14, 2015 00:01
Minimum Vundle Setup with Bootstrap
" To test this file in isolation,
" put it in a folder other then ~/,
" then run 'vim -u vundle-with-bootstrap.vim'.
set nocompatible
filetype off
" modified bootstrap, originally by John Whitley
" https://github.com/jwhitley/vimrc/blob/master/.vim/bootstrap/bundles.vim
var arr = [ "one", "two", "three", "four", "five" ];
jQuery.each(arr, function(index, value) {
console.log(this);
return (this != "three"); // will stop running after "three"
});
$("<input/>", {
id: "permissionsInput",
name: "permissions",
type: "checkbox",
click: function(){
update();
},
checked: "checked"
}).appendTo("#myForm");
@NicholasTD07
NicholasTD07 / argo-enxtenison.swift
Last active August 29, 2015 14:22
Argo extension example
import Argo
let json = [
"urlString": "http://www.example.com",
"timestamp": 1433132865,
"date": "20150525",
"intString": "12345",
]
struct ExampleModel {
@NicholasTD07
NicholasTD07 / protocol-as-parameter.swift
Created June 8, 2015 05:52
Swift protocol as parameter for both class and struct.
protocol Named: class {
var name: String { get set }
}
class Person: Named {
var name: String
init(name: String) {
self.name = name
}
@NicholasTD07
NicholasTD07 / Argo-decode-classes.swift
Last active August 29, 2015 14:22
Argo doesn't work with subclass (Swift 1.2 AND 2.0)
import XCTest
import Argo
import Runes
class SuperClass {
let something: String
init(something: String) {
self.something = something
}
@NicholasTD07
NicholasTD07 / Branch base point after release branch exist.md
Last active August 29, 2015 14:24
Swift ZHI - Development Notes

Branch base point after release branch exists

git merge-base develop release/Xcode-6.3.2-Swift-1.2

It gives the commit before develop and release/ start to differentiate.

WHY?

@NicholasTD07
NicholasTD07 / git-workflow.md
Last active August 29, 2015 14:24
My Git Workflow

My Git Workflow

g = git

About Fine Grained Git Commits

  • Easier to tell what's changed in one line, preferbally in 50 - 72 characters
  • Easier to revert unwanted, published and shared changes by git revert