Skip to content

Instantly share code, notes, and snippets.

View theevo's full-sized avatar

Theo Vora theevo

  • NYC
View GitHub Profile
@brendanjerwin
brendanjerwin / writer
Created May 28, 2011 00:45
open iA writer from the command line
#! /bin/bash
open $1 -a /Applications/iA\ Writer.app
@vcavallo
vcavallo / fork_you.markdown
Last active December 24, 2015 00:09
Forking how-to with descriptions

Forking

essentially like cloning on github's servers - but that's inconsequential, mostly.. also: forks are not automatically up to date (relative to repo you forked)! your fork creates a snapshot of the original repo at the time you fork it.

  • fork on github

  • creates a clone on github servers

  • copy url of that clone

  • git clone [url]

    • clones the content of your fork to your local machine
def normalize_phone_number(number)
clean_num = number.gsub(/[^0-9]/, "")
clean_num.length != 10 ? number : "(#{clean_num[0,3]}) #{clean_num[3,3]}-#{clean_num[6,4]}"
end
@polycarpou
polycarpou / person.rb
Created October 10, 2013 14:45
Day 14: TODO: Mass-assignment of properties at initialization
class Person
def initialize(attributes)
attributes.each do |key,value|
Person.send(:define_method, key){value}
end
end
end
@joemasilotti
joemasilotti / About.md
Last active March 26, 2020 09:35
Building NSURL Queries with NSURLQueryItems and NSURLComponents
//I have a location manager class. This class just holds user current location so that it can be used later in the project.
//This will be singleton class later.Since singletons are hard to test(Because of no DI injection mechanism).I have not
implemented yet for now.The problem is at the end.
class HelperLocationManager:NSObject{
let locationManager:CLLocationManager
init(mgr:CLLocationManager) {
@MainasuK
MainasuK / AppDelegate.swift
Created September 5, 2019 08:05
AppDelegate for iOS 13 with multiple windows supports
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Set up application here
@jagdeepsingh
jagdeepsingh / README.md
Last active December 9, 2021 10:26
Set up macOS Catalina 10.15 with development tools | Git | Homebrew | rbenv | bundler | Atom | Databases | Node.js | Yarn | kubectl | Elastic Stack
import UIKit
struct Chat {
var users: [String]
var dictionary: [String: Any] {
return ["users": users]
}
}
extension Chat {
@ryansobol
ryansobol / Array+Permutations.swift
Last active August 12, 2021 15:38
Generate the permutations of a Swift array
extension Array {
func chopped() -> (Element, [Element])? {
guard let x = self.first else { return nil }
return (x, Array(self.suffix(from: 1)))
}
}
print([1, 2, 3].chopped())
// Optional((1, [2, 3]))