Skip to content

Instantly share code, notes, and snippets.

View jacquesf's full-sized avatar

Jacques Fortier jacquesf

View GitHub Profile
use std::mem;
// Example of a module that loads a tagged union from a raw byte slice.
// The tagged union consists of a 32-bit type field, followed by fields whose types and count
// depend on the tag
//
// The goal is to take a byte slice and return a ref to the appropriate struct depending on
// the tag, or an error in case of overflow of the buffer or unknown tag
//
// I know this doesn't handle endianness. My full implementation does, but I've removed it to
@jacquesf
jacquesf / UIBarButtonItem+JFAdditions.h
Created January 10, 2011 07:39
Method to add a title to an iPad silver-style UIToolbar, implemented as a category on UIBarButtonItem
//
// UIBarButtonItem+JFAdditions.h
//
// Created by Jacques Fortier on 1/10/11.
// Copyright 2011 Jacques Fortier.
// Released under the WTFPL (see LICENSE or http://sam.zoy.org/wtfpl/COPYING)
#import <UIKit/UIKit.h>