Skip to content

Instantly share code, notes, and snippets.

View JackieQi's full-sized avatar

Jackie Qi JackieQi

View GitHub Profile
@JackieQi
JackieQi / Regex.swift
Last active August 31, 2017 21:46 — forked from ningsuhen/Regex.swift
Swift extension for Native String class to support Regex match and Regex replace. Credit - http://www.swift-studies.com/blog/2014/6/12/regex-matching-and-template-replacement-operators-in-swift
import Foundation
struct Regex {
var pattern: String {
didSet {
updateRegex()
}
}
var expressionOptions: NSRegularExpressionOptions {
didSet {
@JackieQi
JackieQi / LRUCache.swift
Created April 7, 2017 21:46
LRU Cache in Swift
class Node<K: Equatable, V> {
var next: Node?
var previous: Node?
var key: K
var value: V?
init(key: K, value: V?) {
self.key = key
self.value = value
}
@JackieQi
JackieQi / hackerrank.swift
Created April 4, 2017 18:30
HackerRank Stdin for Swift
func readLineString() -> [String] {
return readLine()!.characters.split(separator: " ").map{ String($0) }
}
func readLineInt() -> [Int] {
return readLine()!.characters.split(separator: " ").map{ Int(String($0))! }
}
func readData() -> Data {
return FileHandle.standardInput.availableData

Videos

@JackieQi
JackieQi / UpdateXcodePlugins.sh
Created October 22, 2015 17:53
Update Xcode Plugins
#!/bin/bash
xcodeUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
echo $xcodeUUID
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add $xcodeUUID
#checkout loaded plugins
#defaults read com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-7.1
#to force xcode reload bundles
#defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-7.1