Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Cully bjc

View GitHub Profile
View code.rs
#[derive(Copy, Clone, Debug, Default, Deserialize, Serialize)]
#[repr(C, packed)]
pub struct USBDeviceDescriptor {
pub b_length: u8,
pub b_descriptor_type: USBDescriptor,
pub bcd_usb: u16,
pub b_device_class: u8,
pub b_device_sub_class: u8,
pub b_device_protocol: u8,
pub b_max_packet_size: u8,
@bjc
bjc / testSerialization.swift
Created Apr 3, 2016
Change BinaryFormat to XMLFormat, watch test break.
View testSerialization.swift
func testWeirdSerialiation() {
let exp = NSDate()
do {
let data = try NSPropertyListSerialization.dataWithPropertyList(exp, format: .BinaryFormat_v1_0, options: 0)
do {
var format: NSPropertyListFormat = .BinaryFormat_v1_0
if let got = try NSPropertyListSerialization.propertyListWithData(data, options: .MutableContainersAndLeaves, format: &format) as? NSDate {
let foo = got.timeIntervalSinceDate(exp)
XCTAssertEqual(got, exp, "Dates were not the same: \(foo).")
} else {
View keybase.md

Keybase proof

I hereby claim:

  • I am bjc on github.
  • I am bjc (https://keybase.io/bjc) on keybase.
  • I have a public key whose fingerprint is E32E 79DA 2703 13D7 9913 64CC 7683 11D6 76FB 68C3

To claim this, I am signing this object:

View gist:361285
if module:get_host_type() ~= "component" then
error("Call presence module must be loaded as a component.", 0)
end
local serialize = require "util.serialization".serialize
local eventmanager = require "core.eventmanager"
local st = require "util.stanza"
local register_component = require "core.componentmanager".register_component
local deregister_component = require "core.componentmanager".deregister_component
View Object Controller Test
"Support observing non-content properties": function () {
this.c.fireCount = 0;
this.c.nonContentObserver = function () {
this.set('fireCount', this.get('fireCount') + 1);
}.observes('nonContentProp');
// Fire the observer with the first set.
this.c.set('content', SC.Object.create());
this.c.set('nonContentProp', 'test');
this.c.get('fireCount').shouldEqual(1);
View gist:14385
<% popup_menu_view :switchboard_add_menu,
:class => 'menu',
:style => 'padding: 0',
:pane => :menu do -%>
<%= menu_item_view :label => 'Add Contact...',
:target => 'BF.switchboardController',
:action => 'showAddContact' -%>
<% end -%>
<%= popup_button_view :title => '+',