Skip to content

Instantly share code, notes, and snippets.

View this_is_a_bit_more_readable.rb
# This is more "Ruby", and I agree that I don't necessarily agree with
# all the syntax choices. The else condition isn't required as the
# function returns nil if no other code paths executed. You could argue
# that, that is a regression waiting to happen though.
def just_one_kind_of_response? item, controller
case controller
when 'actions'
item.comments.blank? or item.suggestions.blank? or detail.comments.blank?
when 'thoughts'
View PromiseKit + YOLO?
// Trying to write a function that does some select/map magic with easy error handling
let cities = [[
"name": "Geneva",
"population": 184538
"name": "Bern",
"population": 123154
], [
"name": "Zurich",
View mergesort.swift
import Darwin //.C.stdlib
// updated for Swift 2.0 beta4
private func merge<T: Comparable>(a: ArraySlice<T>, _ b: ArraySlice<T>, mergeInto acc: ArraySlice<T> = []) -> ArraySlice<T> {
guard let aF = a.first, bF = b.first else {
return acc + a + b
return aF < bF
? merge(dropFirst(a), b, mergeInto: acc + [aF])
mxcl /
Last active Mar 13, 2016 — forked from aciidb0mb3r/
Lock file proposal

Dependency Locking with the Swift Package Manager


In a vibrant packaging ecosystem, dependencies update continuously with bug-fixes and feature improvements. When working against a collection of dependencies, especially in a team, it is vital to lock the graph and update it so that all team members receive the exact same graph at the same time.

The typical flow for this in dependency management is to create and use a dependency “Lockfile”.