Skip to content

Instantly share code, notes, and snippets.

@dodomarocgenex
dodomarocgenex / spacemacs-cheshe.md
Created August 3, 2019 19:57 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
@dodomarocgenex
dodomarocgenex / System Design.md
Created July 30, 2019 05:45 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@dodomarocgenex
dodomarocgenex / allSubViews
Created August 20, 2018 23:51
All subviews of a UIView
extension UIView {
var allSubViews : [UIView] {
var array = [self.subviews].flatMap {$0}
array.forEach { array.append(contentsOf: $0.allSubViews) }
return array
}
}
@dodomarocgenex
dodomarocgenex / Onboarding_with_user_defaults
Created August 20, 2018 15:45
Onboarding with user defaults
You can use a flag and store it via NSUserDefaults.
extension UserDefaults {
private static let didLaunchAppOnceKey = "didLaunchAppOnce"
var didLaunchAppOnce: Bool {
get { return bool(forKey: UserDefaults.didLaunchAppOnceKey) }
set { set(newValue, forKey: UserDefaults.didLaunchAppOnceKey) }
}
@dodomarocgenex
dodomarocgenex / PlaygroundUIDesign
Created August 18, 2018 14:03
UI elements in a playground
import Foundation
import UIKit
import PlaygroundSupport
let someView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 200))
someView.backgroundColor = UIColor.red
PlaygroundPage.current.liveView = someView
import Foundation
public extension String {
public func rangeFromNSRange(aRange: NSRange) -> Range<String.Index> {
let s = advance(self.startIndex, aRange.location)
let e = advance(self.startIndex, aRange.location + aRange.length)
return s..<e
}
public var ns : NSString {return self as NSString}
public subscript (aRange: NSRange) -> String? {
@dodomarocgenex
dodomarocgenex / gist:768408b0165da8fade56
Last active August 29, 2015 14:27
Being a lazy ninja
//in viewDidLoad
enum Suit {
case Clubs, Diamonds, Hearts, Spades
}
enum Rank {
case Jack, Queen, King, Ace
case Num(Int)
}
enum Suit {
case Clubs, Diamonds, Hearts, Spades
}
enum Rank {
case Jack, Queen, King, Ace
case Num(Int)
}
struct Card {