Skip to content

Instantly share code, notes, and snippets.

func async(queue: dispatch_queue_t, f: () -> Void) {
dispatch_async(queue, f)
}
func async(f: () -> Void) {
async(dispatch_get_main_queue(), f)
}
async {
println("Hello")
extension String {
subscript (r: Range<Int>) -> String {
let indexRange = Range(start: advance(self.startIndex, r.startIndex), end: advance(self.startIndex, r.endIndex))
return self[indexRange]
}
subscript (i: Int) -> Character {
return self[advance(self.startIndex, i)]
}
}
import Foundation
class File: Sequence, Generator {
typealias GeneratorType = File
typealias Element = String
var handle: UnsafePointer<FILE>?
init(path: String) {
protocol OtherType {
typealias foo
}
protocol Foo: OtherType {
func extend<S : OtherType where S.foo == Self.foo>(sequence: S) -> S
}
diff --git a/VirtualJaguar/VirtualJaguar/JaguarGameCore.h b/VirtualJaguar/VirtualJaguar/JaguarGameCore.h
index 66b7c3b..d3c106c 100644
--- a/VirtualJaguar/VirtualJaguar/JaguarGameCore.h
+++ b/VirtualJaguar/VirtualJaguar/JaguarGameCore.h
@@ -32,7 +32,7 @@ OE_EXPORTED_CLASS
@interface JaguarGameCore : OEGameCore
- (void)initVideo;
-void audio_callback_batch(uint8 *buff, int len);
+void audio_callback_batch(uint16_t *buff, int len);
//
// main.c
// CopyList
//
// Created by Joshua Weinberg on 3/25/13.
// Copyright (c) 2013 Joshua Weinberg. All rights reserved.
//
#include <iostream>
#include <map>
//
// main.c
// CopyList
//
// Created by Joshua Weinberg on 3/25/13.
// Copyright (c) 2013 Joshua Weinberg. All rights reserved.
//
#include <iostream>
#include <map>
//
// main.c
// CopyList
//
// Created by Joshua Weinberg on 3/25/13.
// Copyright (c) 2013 Joshua Weinberg. All rights reserved.
//
#include <iostream>
#include <map>
NSString *str = [[NSString alloc] initWithBytes:({uint32_t t = 0x1F4A9; &t;}) length:4 encoding:NSUTF32LittleEndianStringEncoding];
NSLog(@"%@", str);
const int CLK = 1;
const int STROBE = 0;
const int DATA = 2;
int buttons[8] = {0,0,0,0,0,0,0,0};
int shift = 0;
void setup() {
Serial.begin(115200);
pinMode(CLK, INPUT_PULLUP);