Skip to content

Instantly share code, notes, and snippets.

View lin's full-sized avatar

Albert Lin lin

View GitHub Profile
@lin
lin / UILabelExtension.swift
Last active August 29, 2015 14:20
UILabel Extension swift
import UIKit
extension UILabel {
func setAttributedTextString(string: String) {
self.attributedText = NSAttributedString(string: string, attributes: self.attributedText.attributesAtIndex(0, effectiveRange: nil))
}
func setKern(kern: CGFloat) {
var attributes = self.attributedText.attributesAtIndex(0, effectiveRange: nil)
@IBAction func loginButtonDidCicked(sender: AnyObject?) {
    performSegueWithIdentifier("loginDialogSegue", sender: self)   
}

Delegation, which two View Controllers to communicate with each other

@lin
lin / auto_layout.swift
Last active August 29, 2015 14:20
Auto Layout in Swift
//
// ViewController.swift
// SwiftAutoLayout
//
// Created by Steven Lipton on 7/24/14.
// Copyright (c) 2014 Steven Lipton. All rights reserved.
//
import UIKit

My understanding of how to define a view or view controller

1, view

View is an element of a full screen page.

"View controllers are a vital link between an app’s data and its visual appearance"

What view does is to reuse the same ui design and the same user interactions.

@lin
lin / 1 preview.html
Last active March 23, 2018 05:18
Multiple images upload
<!-- http://www.html5rocks.com/en/tutorials/file/dndfiles/#toc-reading-files -->
<script>
function handleFileSelect(evt) {
var files = evt.target.files; // FileList object
// Loop through the FileList and render image files as thumbnails.
for (var i = 0, f; f = files[i]; i++) {
// Only process image files.

1, git remote -v, check remote links

origin	https://github.com/rmajmudar/popinshop.git (fetch)
origin	https://github.com/rmajmudar/popinshop.git (push)

2, git remote rm origin, remove old remote links

3, git remote -v, check remote links, it should be empty now.

4, git remote add origin https://github.com/linyingkui/popinshop.git, add new remote links

@lin
lin / 1-rails.md
Last active August 29, 2015 14:23
Albertly.com setup doc
@lin
lin / 1-layer-view.md
Last active August 29, 2015 14:24
iOS Learning.

1, A layer is just a container for managing a bitmap image

2,The job of a view controller is to manage a view hierarchy

3, The viewWillLayoutSubviews method is also called after the view is resized and positioned by its parent. When a view's bounds change, the view adjusts the position of its subviews.

4, A view controller: resizes and lays out its views, adjusts the contents of the views, acts on behalf of the views when the user interacts with them

1, read changes

git diff difference between current codes and HEAD codes

git diff HEAD the same as git diff

git diff HEAD^^ two commits before HEAD

git diff HEAD~5 five commits before HEAD

// temp
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let mixpanel = Mixpanel.sharedInstance()
if let user = LUVApi.sharedInstance().currentUser {
mixpanel.identify(user.id)
mixpanel.people.addPushDeviceToken(deviceToken)
}
}