Skip to content

Instantly share code, notes, and snippets.

View Burgestrand's full-sized avatar
🙃
(:

Kim Burgestrand Burgestrand

🙃
(:
View GitHub Profile
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@calebd
calebd / ActionSheetPresentationController.swift
Created July 18, 2017 02:42
Action Sheet Presentation Controller
// Created by Caleb Davenport on 7/14/17.
import UIKit
final class ActionSheetPresentationController: UIPresentationController {
// MARK: - Properties
private var dimmingView: UIView!
@Limon-O-O
Limon-O-O / TransitionCompositionBuilder.swift
Last active July 16, 2023 15:04
Merging videos with cross-fade effect using AVFoundation
//
// TransitionComposition.swift
// MED
//
// Created by Limon on 7/26/16.
// Copyright © 2016 MED. All rights reserved.
//
import AVFoundation
@Burgestrand
Burgestrand / whitespace.rb
Created August 30, 2012 07:13
A whitespace thingy in Ruby, just for the lulz
# coding: utf-8
class Whitespace
def initialize(&block)
@data = 0
@pos = -1
instance_eval(&block)
end
def  
tap { @pos += 1 }
@ryandotsmith
ryandotsmith / instruments.rb
Created April 6, 2012 07:09
Sequel & Sinatra Instrumentation
module Instruments
def self.set_logger(l, m)
@logger = l
@method = m
end
def self.logger
@logger
end
@Burgestrand
Burgestrand / eval_bang.rb
Created February 14, 2012 20:22
A Ruby method that evals a string of code and returns a hash of all locals defined inside
# Eval a string of code, returning a hash of all local variables and their values.
#
# @param [String] code
# @param [Binding] binding
# @param [String] file (shows up in backtrace if an error occurs)
# @param [Integer] line (shows up in backtrace if an error occurs)
# @return [Hash] a map of :local_var => value_of_that_var
def eval!(__code__, binding = nil, file = __FILE__, line = (__LINE__ + 1))
eval <<-SOURCE, binding, file, line
#{__code__}
@Raynos
Raynos / weak-map.js
Last active September 18, 2019 07:49 — forked from Gozala/weak-map.js
Harmony WeakMap shim for ES5
// Original - @Gozola. This is a reimplemented version (with a few bug fixes).
window.WeakMap = window.WeakMap || (function () {
var privates = Name()
return {
get: function (key, fallback) {
var store = privates(key)
return store.hasOwnProperty("value") ?
store.value : fallback
},
@Burgestrand
Burgestrand / replacer.rb
Created December 8, 2011 16:58
Using s/string/string/ to replace things in strings… YAY RUBY!
class Proc
alias :/ :call
end
def s
optmap = {
"x" => Regexp::EXTENDED,
"i" => Regexp::IGNORECASE,
"m" => Regexp::MULTILINE
}
@andormade
andormade / main.c
Created November 12, 2011 18:00
Audio Queue example
#include <stdlib.h>
#include <math.h>
#include <AudioToolbox/AudioQueue.h>
#include <CoreAudio/CoreAudioTypes.h>
#include <CoreFoundation/CFRunLoop.h>
#define NUM_CHANNELS 2
#define NUM_BUFFERS 3
@Burgestrand
Burgestrand / hallon_enumerator.rb
Created September 26, 2011 21:40
Proof of concept for a lazy Enumerator
require 'ostruct'
require 'delegate'
module Hallon
class Enumerator < SimpleDelegator
attr_reader :size
def initialize(size, pointer, &block)
@pointer = pointer
@items = Array(0...size)