Skip to content

Instantly share code, notes, and snippets.


Kim Burgestrand Burgestrand

View GitHub Profile
View Environment.swift
public struct Environment {
init() {
public var name = "World"
public var Current: Environment! = Environment()

Keybase proof

I hereby claim:

  • I am burgestrand on github.
  • I am burgestrand ( on keybase.
  • I have a public key ASAzL_nNQVmzYZH1Fdq62TaGQrrOpJizAZRGBmVfXH-kYgo

To claim this, I am signing this object:

View code.swift
import Foundation
func test(count: Int) -> UInt8 {
precondition(count >= 1)
let ptr = UnsafeMutableRawPointer.allocate(byteCount: count, alignment: 1)
ptr.storeBytes(of: 0, toByteOffset: 0, as: UInt8.self)
let data = Data(bytesNoCopy: ptr, count: count, deallocator: .none)
ptr.storeBytes(of: 13, toByteOffset: 0, as: UInt8.self)
Burgestrand / Gemfile
Last active Mar 15, 2018
Speech recognition in Ruby using Google Cloud Speech and Easy Audio
View Gemfile
# frozen_string_literal: true
source ""
git_source(:github) {|repo_name| "{repo_name}" }
gem "easy_audio", github: "lsegal/easy_audio"
gem "google-cloud-speech"
gem "pry"
View codable.swift
import Foundation
import CoreGraphics
var points: [CGPoint] = []
points.append(CGPoint(x: 10, y: 20))
let encoder = JSONEncoder()
let encoded = try! encoder.encode(points)
let json = String(data: encoded, encoding: .utf8)!
Burgestrand / hub.swift
Last active Jan 23, 2017
A statically typed notification center in Swift
View hub.swift
import class Foundation.NotificationCenter
import struct Foundation.Notification
Swift does not allow us to have static members of a generic class, which
means we won't be able to use the dot short hand for any method that takes
an Event<T> as parameter.
However, we can work around this by having a superclass, `Events`, and then
inherit it from it in our `Event<T>`. Any static members of `Events` will
Burgestrand / Gemfile
Last active Aug 29, 2015
Celluloid, exclusive, and blocks executed on receiver
View Gemfile
source ""
gem "celluloid", github: "celluloid/celluloid", branch: "master"
View dispatcher.rb
require "queue"
require "timeout"
module Spotify
class Dispatcher
class Work
class DoubleResultError < StandardError; end
def initialize(callable)
@callable = callable
Burgestrand /
Created Apr 25, 2013
Coffee script annotated output
var Kitten, Mooer, _ref,
__hasProp = {}.hasOwnProperty,
__extends = function (child, parent)
for (var key in parent)
if (, key)) child[key] = parent[key];
function ctor()
Burgestrand / sass.rb
Created Apr 17, 2013
An FFI binding for libsass for a Got.rb meetup, libsass at
View sass.rb
require "ffi"
module Sass
extend FFI::Library
ffi_lib "sass"
module MemoryString
extend FFI::DataConverter
native_type FFI::Type::POINTER