Skip to content

Instantly share code, notes, and snippets.

View beccadax's full-sized avatar

Becca Royal-Gordon beccadax

View GitHub Profile
@beccadax
beccadax / Example.swift
Last active April 7, 2016 11:19
Suggested replacement for C-style for.
// Sequence of 1, 2, 4 ... 64
induce(from: 1, to: 128, by: { $0 * 2 })
induce(from: 1, to: 128, by: { $0 *= 2 })
// Sequence of 1, 2, 4 ... 128
induce(from: 1, through: 128, by: { $0 * 2 })
induce(from: 1, through: 128, by: { $0 *= 2 })
// Sequence of 1, 2, 4 ... with arbitrary, calculated bound
import Darwin
@praeclarum
praeclarum / ArrayDiff.swift
Last active January 8, 2021 06:10
A generic diffing operation that can calculate the minimal steps needed to convert one array to another. It can be used to generate standard diffs, or it can be used more creatively to calculate minimal UI updates.
//
// ArrayDiff.swift
//
// Created by Frank A. Krueger on 6/30/15.
// Copyright © 2015 Krueger Systems, Inc. All rights reserved.
// License: MIT http://opensource.org/licenses/MIT
//
import Foundation
@tstachl
tstachl / export.rb
Created December 18, 2014 23:44
This is a very rudimentary script of exporting data from desk.com to a CSV file.
require 'desk_api'
require 'csv'
# Create the CSV files
cases = CSV.open('./cases.csv', 'wb')
interactions = CSV.open('./interactions.csv', 'wb')
# Add the headers to the CSV files
cases << ['Case #', 'Subject', 'Description', 'Status']
interactions << ['Case #', 'Body', 'Created Date']