Skip to content

Instantly share code, notes, and snippets.

Avatar

Benny Wong bdotdub

View GitHub Profile
View SwiftUIInPlaygrounds.swift
import PlaygroundSupport
import SwiftUI
struct CityRow: View {
var body: some View {
Text(place)
}
var place: String
}
View rdar23374935.md

CoreBluetooth not discovering peripherals

rdar://23374935

Summary:

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 git@github.com:sandeepmistry/osx-ble-peripheral.git
  2. Clone this example on an Apple TV: git clone git@github.com:bdotdub/CBExample.git
View gotest
#!/bin/bash
hash fswatch 2>/dev/null || brew install fswatch
function stopping() {
echo "Done"
exit 0
}
trap stopping SIGINT
@bdotdub
bdotdub / futurable1.rb
Last active Aug 29, 2015
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)
View keybase.md

Keybase proof

I hereby claim:

  • I am bdotdub on github.
  • I am bdotdub (https://keybase.io/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
bdotdub / README.md
Last active Aug 29, 2015
Map for Brokelyn's Beer Book 6
@bdotdub
bdotdub / gist:5877359
Created Jun 27, 2013
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"