This file contains hidden or 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
## ttyUSB0 - getty | |
## | |
## This service maintains a getty on ttyUSB0 from the point the system is | |
## started until it is shut down again. | |
start on stopped rc or RUNLEVEL=[12345] | |
stop on runlevel [!12345] | |
respawn | |
exec /sbin/getty ttyUSB0 115200 |
This file contains hidden or 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
func max1(numbers: [Int]) -> Int { | |
var maximumSoFar: Int = 0 | |
for i in numbers { | |
maximumSoFar = max(maximumSoFar, i) | |
} | |
return maximumSoFar | |
} | |
Compiled with -Ofast -emit-assembly: |
This file contains hidden or 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
/** | |
Using iExplorer, navigate to CSR Racing and extract the file from | |
/Library/Caches/pp. | |
$ mv user85500672{,.gz} | |
$ gunzip user85500672.gz | |
$ edit user85500672 | |
Remove the signature (first line). Edit "caea", "casp", "goea", and "gosp" | |
to modify your cash earned, cash spent, gold earned, and gold spent |
This file contains hidden or 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
protocol MyProtocol { | |
func methodFromProtocol() | |
} | |
class MyClass { | |
func methodFromClass() { | |
println("hello class") | |
} | |
} |
This file contains hidden or 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
// http://stackoverflow.com/questions/26868663/switch-statement-in-objective-c | |
#include <stdio.h> | |
int main() { | |
int myVar = 2; | |
switch (myVar) { | |
case 1: { | |
printf("one\n"); |
This file contains hidden or 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
typedef NS_OPTIONS(NSUInteger, LSRBorderSide) { | |
LSRBorderSideNone = 1 << 0, | |
LSRBorderSideLeft = 1 << 1, | |
LSRBorderSideRight = 1 << 2, | |
LSRBorderSideBottom = 1 << 3, | |
LSRBorderSideTop = 1 << 4 | |
}; |
This file contains hidden or 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
class IncrementorSequence : SequenceType { | |
func generate() -> GeneratorOf<Int> { | |
var value = 0 | |
return GeneratorOf<Int> { | |
return value++ | |
} | |
} | |
} |
This file contains hidden or 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
// This playground was built for Xcode 6.2 and is compatible with Xcode 6.3b3. | |
// The contents are true to the best of my knowledge and are not an April Fools joke. | |
// However, if you -actually- implement some of this stuff... | |
// In Swift, Void is a typealias for an empty tuple | |
// Cmd-Click the keyword Void to see this typealias | |
func example1() { | |
let myVoid: Void = () | |
println("\(myVoid)") | |
} |
This file contains hidden or 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
// Which convention for init args do you prefer? | |
// Naming the arguments the same as the fields requires explicitly naming self | |
class MyFirstClass { | |
var i: Int | |
var s: String | |
init(i: Int, s: String) { | |
self.i = i | |
self.s = s |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdint.h> | |
union BitAccessor { | |
uint64_t u64; | |
struct { | |
uint32_t _0, _1; | |
} u32; | |
struct { | |
uint16_t _0, _1, _2, _3; |