Skip to content

Instantly share code, notes, and snippets.

View bdotdub's full-sized avatar

Benny Wong bdotdub

View GitHub Profile
View SwiftUIInPlaygrounds.swift
import PlaygroundSupport
import SwiftUI
struct CityRow: View {
var body: some View {
var place: String

CoreBluetooth not discovering peripherals



Bluetooth LE devices are never detected by a CBCentralManager when scanning for all devices.

Steps to Reproduce:

  1. Clone and run a Bluetooth LE peripheral, e.g. git clone
  2. Clone this example on an Apple TV: git clone
View gotest
hash fswatch 2>/dev/null || brew install fswatch
function stopping() {
echo "Done"
exit 0
trap stopping SIGINT
bdotdub / futurable1.rb
Last active August 29, 2015 13:59
This don't make nooo sense. In theory, it should be almost semantically equivalent, `Futurable1` making only one more access to `Celluloid::Actor[:Futurable1]`. The `||=` is essentially checking for `nil` before assigning. Why it's such a big difference, I'd love to know.
View futurable1.rb
require "benchmark"
require "celluloid"
class Futureable1
include Celluloid
class << self
def p
if Celluloid::Actor[:Futureable1].nil?
Celluloid::Actor[:Futureable1] = Futureable1.pool(size: 2)

Keybase proof

I hereby claim:

  • I am bdotdub on github.
  • I am bdotdub ( on keybase.
  • I have a public key whose fingerprint is B18B F283 8D8D AD9C 1ADA 4E47 6831 9EB8 C97E 1325

To claim this, I am signing this object:

View heroku_invoice_to_csv.js
var $apps = $(".app");
var costTable = function(csv, year, month, appName, $app, type) {
console.log(csv, appName, $app, type);
var $dynos = $app.find("." + type + " tbody tr");
for (var j = 0; j < $dynos.length; j++) {
var $dyno = $($dynos.get(j));
var $fields = $dyno.find("td");
if ($fields.length != 4) {
bdotdub /
Last active August 29, 2015 13:55
Map for Brokelyn's Beer Book 6
bdotdub / gist:5877359
Created June 27, 2013 15:20
3.2 Rails.cache weirdness
View gist:5877359
Loading development environment (Rails 3.2.13)
1.9.3p286 :001 > Rails.cache.fetch("test") { "benny" }
=> "benny"
1.9.3p286 :002 > Rails.cache.fetch("test") { "benny" }
=> "\x04\bI\"\nbenny\x06:\x06ET"
bdotdub /
Created February 1, 2013 20:38
Map for Brokelyn's Beer Book 3
bdotdub /
Created February 1, 2013 20:35
Map for Brokelyn's Beer Book 4