Skip to content

Instantly share code, notes, and snippets.

View Burgestrand's full-sized avatar
🙃
(:

Kim Burgestrand Burgestrand

🙃
(:
View GitHub Profile
@Burgestrand
Burgestrand / Procfile.dev
Last active April 5, 2024 08:32
A custom livereload using Turbo 8 morph, Turbo Stream, and Listen.
cable: WEB_CONCURRENCY=0 PORT=28080 bundle exec puma config/cable.ru
#####################################################################
# BTT Octopus Pin Aliases
# See https://github.com/VoronDesign/VoronUsers/tree/master/firmware_configurations/klipper/revnull/btt_octopus_pins
#####################################################################
[board_pins]
aliases:
# Stepper drivers
MOT0_EN=PF14, MOT0_STEP=PF13, MOT0_DIR=PF12, MOT0_CS=PC4, # MOTOR0
MOT1_EN=PF15, MOT1_STEP=PG0, MOT1_DIR=PG1, MOT1_CS=PD11, # MOTOR1
public struct Environment {
init() {
print("Current.init")
}
public var name = "World"
}
public var Current: Environment! = Environment()
@Burgestrand
Burgestrand / keybase.md
Created April 15, 2020 06:47
keybase.md

Keybase proof

I hereby claim:

  • I am burgestrand on github.
  • I am burgestrand (https://keybase.io/burgestrand) on keybase.
  • I have a public key ASAzL_nNQVmzYZH1Fdq62TaGQrrOpJizAZRGBmVfXH-kYgo

To claim this, I am signing this object:

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
Burgestrand / Gemfile
Last active March 15, 2018 15:15
Speech recognition in Ruby using Google Cloud Speech and Easy Audio
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "easy_audio", github: "lsegal/easy_audio"
gem "google-cloud-speech"
gem "pry"
import Foundation
import CoreGraphics
var points: [CGPoint] = []
points.append(.zero)
points.append(CGPoint(x: 10, y: 20))
let encoder = JSONEncoder()
let encoded = try! encoder.encode(points)
let json = String(data: encoded, encoding: .utf8)!
@Burgestrand
Burgestrand / hub.swift
Last active March 3, 2021 09:35
A statically typed notification center in 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
Burgestrand / Gemfile
Last active August 29, 2015 14:19
Celluloid, exclusive, and blocks executed on receiver
source "https://rubygems.org"
gem "celluloid", github: "celluloid/celluloid", branch: "master"
require "queue"
require "timeout"
module Spotify
class Dispatcher
class Work
class DoubleResultError < StandardError; end
def initialize(callable)
@callable = callable