This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What's the difference between a cookie and a session? | |
A cookie is a string of data that is set on response to be stored on client. It works as an encrypted data package used for managing communication. | |
A session is more like an object that exists on the request | |
2. What's serialization and how does it come into play with cookies? | |
Object --> string (Cookies serialize data) | |
3. Can a cookie be shared by more than one user? How/why? | |
Yes, if both users are on the same client. (But really shouldn't be) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. What does it mean for an application to be multi-tenant? | |
2. What would you want to build an application to be multi-tenant? | |
3. How do you implement multi-tenancy at the data / database level? | |
4. How do Active Record scopes help keep tenant data segregated? | |
5. Why is multi-tenancy dangerous from a security/privacy perspective? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The idea of genius is often based on some unnatural skill or knowledge. But new science on the idea of mylination and deep practice pushes us to rethink this. I will be discussing this idea, and the application of it to programming as associated skills. Looking at specifically code kata, touch typing, and logical thinking. I don't know what else you want in a gist so...thats it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Access to the new NSLinguisticTagger APIs are provided as a public enum as: | |
public enum NSLinguisticTagger: Int { | |
case word | |
case sentence | |
case paragraph | |
case document | |
} | |
//To see what units and schemes are available use a class level function: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" File: nudge.py | |
An lldb Python script to add a nudge command. | |
Add to ~/.lldbinit: | |
command script import ~/path/to/nudge.py | |
Usage: | |
(lldb) nudge x-offset y-offset [view] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// Merge sort in Swift | |
// Split arrays | |
func mergeSort(array: [Int]) -> [Int] { | |
guard array.count > 1 else { | |
return array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func bubbleSort(array: [Int]) -> [Int] { | |
var array = array | |
for i in 0..<array.count { | |
for j in 1..<array.count - i { | |
if array[j] < array[j - 1] { | |
array.swapAt(j, j - 1) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Nucleotide { | |
private let validNucleotides = "ATCG" | |
private var errorMessage: ((Character) -> (String)) = { n in | |
return "\(n) is not a valid Nucleotide" | |
} | |
let dna: String | |
init(_ dna: String) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func quickSort(array: inout [Int], low: Int, high: Int) { | |
// if the high index value is greater than the low index value we need to partition and sort | |
if high > low { | |
// determine our pivot index by generating partitions | |
let pi = partition(array: &array, low: low, high: high) | |
// recursively pass our upper and lower partitions back into quickSort using the new pivot index | |
quickSort(array: &array, low: low, high: pi - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Car { | |
let make: String | |
let model: String | |
var color: String | |
private(set) var mileage: Int? = 0 | |
mutating func update(mileage: Int) { | |
self.mileage = mileage | |
} |
OlderNewer