This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare function require(module:string):any; | |
declare var process:any; | |
var readline = require('readline'); | |
var fs = require('fs'); | |
type brainfuckDone = (char : string) => void; | |
type brainfuckInput = (done : brainfuckDone) => void; | |
function brainfuck(tokens : string[], inp : brainfuckInput) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function await(generatorFunction) { | |
let gen = generatorFunction(); | |
/** | |
* @param {any?} err The error to throw in the generator, where yield was last called. | |
* @param {any?} result The result to pass to the genarator for the last call to yield | |
*/ | |
function next(err, result) { | |
// If the last promise that was yielded was rejected, | |
// trigger an error inside the generator where yield was last called |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Sectional Sale | |
prefix operator >> {} | |
postfix operator >> {} | |
public prefix func >>(rhs: UInt16) -> UInt16 -> UInt16 { | |
return { lhs in lhs >> rhs } | |
} | |
public postfix func >>(lhs: UInt16) -> UInt16 -> UInt16 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creating a generic recursive data structure with autoclosure. (READ ALL NOTES; THIS MAY NOT DO WHAT YOU WANT.) | |
// Closures are reference types, so the size is known (? I think ?) | |
// Note that this is just because of unimplemented features in the compiler in Beta5 | |
// There's no reason to think this is a long-term requirement. | |
// IMPORTANT: the closure will run every time you access this value, so if that has | |
// side effects, this won't work. It's only possible on pure value types. | |
// But the fact that this works as expected is actually kind of incredible. | |
// Think about what is required for it to work out the type for NestedList.Elem("first"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UIView (MPAdditions) | |
@end | |
@implementation UIView (MPAdditions) | |
- (id)debugQuickLookObject { | |
if (self.bounds.size.width < 0.0f || self.bounds.size.height < 0.0f) { | |
return nil; | |
} | |
NewerOlder