Skip to content

Instantly share code, notes, and snippets.


Jim Kubicek jkubicek

View GitHub Profile
View git-checkout-main
git checkout (git-main)
git pull
jkubicek /
Last active Jul 28, 2017
Script running Fish script

The s function takes a single string argument and runs an executable located in the ./scripts/ directory that has the same path as the parameter

function s --argument SCRIPT_NAME
  eval ./scripts/$SCRIPT_NAME

The print-scripts function returns a space-separated list of all executables located in ./scripts/

jkubicek / AlertQueue.swift
Last active Jun 30, 2017
Dispatch Alert Queue for iOS
View AlertQueue.swift
//: Playground - noun: a place where people can play
import Foundation
import PlaygroundSupport
class AlertQueue {
private let queue = DispatchQueue(label: "com.collectivehealth.alertqueue")
typealias Completion = () -> ()
View formatting.swift
import UIKit
//: # Collections
// This is bad
let badArray = ["one", "two", "apple",
"orange", "elephant", "orangutan"]
// This is good
let goodArray = ["one",
View lazyLeaks.swift
import Foundation
struct ExpensiveType {
init(name: String) {
print("This is expensive: \(name)")
class MyType {
jkubicek / open-in-gmail.scpt
Created Feb 25, 2016
Applescript to open the currently selected Mail message in Gmail
View open-in-gmail.scpt
tell application "Mail"
set the_messages to selected messages of first message viewer
set the_headers to all headers of item 1 of the_messages
set thecommandstring to "echo \"" & the_headers & "\"| sed -n -e 's/Message-Id: <\\(.*\\)>/\\1/p'" as string
set sedResult to do shell script thecommandstring
set link to "" & sedResult
do shell script "open " & link
end tell
jkubicek / Fix embedded framework versions
Last active Nov 3, 2015
Fix embedded framework version numbers
View Fix embedded framework versions
# Add this script as a build phase in your project. It will update
# all embeded framework marketing versions and build version to be
# equal to the marketing and build version in your main app.
# More details:
PLIST_PATH=$(dirname $PLIST_PATH)/$(basename $PLIST_PATH .plist)
jkubicek / NSManagedObject.swift
Created Jul 2, 2015
managed object creation extension
View NSManagedObject.swift
protocol ManagedObject {
static var entityName: String { get }
extension ManagedObject where Self: NSManagedObject {
static func createWithContext(context: NSManagedObjectContext) -> Self {
return Self.createWithContext(context, entityName: self.entityName)
jkubicek / gist:fe2dbc7ad583ffacf2b6
Last active Aug 29, 2015
Swift nil-check compound assignment operator.
View gist:fe2dbc7ad583ffacf2b6
infix operator ??= {}
func ??=<T>(inout optional: T?, value: T) {
if optional == nil {
optional = value
var id: Int? = nil
jkubicek /
Created Dec 16, 2014
Keybase Validation

Keybase proof

I hereby claim:

  • I am jkubicek on github.
  • I am jkubicek ( on keybase.
  • I have a public key whose fingerprint is 7E94 5E4C 38D6 0CE5 C3AE 7AA6 6D5A 35E1 86AF D4A5

To claim this, I am signing this object: