Skip to content

Instantly share code, notes, and snippets.

import Foundation
class NetworkService
{
lazy var configuration: NSURLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration()
lazy var session: NSURLSession = NSURLSession(configuration: self.configuration)
let url: NSURL
init(url: NSURL) {
@jylock
jylock / UIViewBordersExtension.swift
Created July 22, 2016 02:23
IBInspectable Setup
import UIKit
extension UIView
{
@IBInspectable var cornerRadius: CGFloat {
get {
return self.layer.cornerRadius
}
set {
self.layer.cornerRadius = newValue
Sorting:
No comparison sort can have better worst-case performance than O(nlog(n))
You can make any sorting algorithm stable by assigning a sequence number to each element and using the sequence number as the
tie-breaker in the multikey sort
Selection Sort:
O(n^2) in all cases. It requires only O(n) swaps, however, it is suitable for data sets where copying is very expensive.
Insertion Sort:
Efficient when dealing with mostly sorted data sets, where it can have O(n) performance, but average and worst cases are O(n^2).
@jylock
jylock / react-proj-bootstrap-temp.txt
Last active November 15, 2017 11:05
Starting new React project
link to codeacademy tutorial
https://www.codecademy.com/articles/react-setup-v
npm init
npm install --save react
npm install --save react-dom (npm i -S {react,react-dom})
npm install --save-dev babel-core babel-loader babel-preset-env babel-preset-react (npm i -D babel-{core,loader} babel-preset-env babel-preset-react)
In root dir, create a file '.babelrc'
{"presets": ["env", "react"]}