You can run this program on any LMC emulator, such as http://peterhigginson.co.uk/LMC/
LMC, which stands for Little Man Computer is a model of a computer, used to teach students how CPUs work. Read More.
| // | |
| // APAspectFitImageView.h | |
| // autolayout | |
| // | |
| // Created by Antol Peshkov on 16.10.14. | |
| // Copyright (c) 2014 Antol Peshkov. All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> |
| #! /usr/bin/swift | |
| import ScriptingBridge | |
| @objc protocol iTunesTrack { | |
| optional var name: String {get} | |
| optional var album: String {get} | |
| } | |
| @objc protocol iTunesApplication { |
| /// 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 { |
| extension String { | |
| var composedCount : Int { | |
| var count = 0 | |
| enumerateSubstringsInRange(startIndex..<endIndex, options: .ByComposedCharacterSequences) {_ in count++} | |
| return count | |
| } | |
| } |
You can run this program on any LMC emulator, such as http://peterhigginson.co.uk/LMC/
LMC, which stands for Little Man Computer is a model of a computer, used to teach students how CPUs work. Read More.
| 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 |
| 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) { |
| import Cocoa | |
| protocol Thing { | |
| var x: String {get} | |
| init(s: String) | |
| } | |
| class Foo: Thing { | |
| let x: String |
| private class MyArrayBuffer<Element>: ManagedBuffer<Int,Element> { | |
| func clone() -> MyArrayBuffer<Element> { | |
| return self.withUnsafeMutablePointerToElements { elements -> MyArrayBuffer<Element> in | |
| return MyArrayBuffer<Element>.create(self.allocatedElementCount) { newBuf in | |
| newBuf.withUnsafeMutablePointerToElements { newElems->Void in | |
| newElems.initializeFrom(elements, count: self.value) | |
| } | |
| return self.value |