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
#!/bin/bash | |
export FOO=100 | |
python - <<END | |
import os | |
print "foo:", os.environ['FOO'] | |
END |
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
// nodewar.com library function… | |
// o.lib.targeting.simpleTarget(ship, pos) | |
// | |
// mostly deobfuscated/deminified | |
// | |
function simpleTarget(ship, pos) { | |
var i, r, h, | |
torque = 0, | |
thrust = 0, | |
dir = o.lib.targeting.dir(ship, pos); |
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
#!/usr/bin/env python | |
# How to post code snippets (especially Python) into comment systems | |
# that don't preserve whitespace. | |
# Save this as a script called 'convert_leading_spaces_to_nonbreaking' | |
# in your PATH and do "chmod +x" on it. | |
# | |
# In Linux, you can then use it by installing xsel and doing: | |
# |
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
func arc4random_uniform<T: SignedIntegerType>(max: T) -> T { | |
let max32: Int32 = numericCast(max) | |
return T(Int64(arc4random_uniform(UInt32(max32)))) | |
} | |
func arc4random_uniform<T: UnsignedIntegerType>(max: T) -> T { | |
let max32: UInt32 = numericCast(max) | |
return T(UInt64(arc4random_uniform(max32))) | |
} |
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
import Swift | |
import Cocoa | |
// Properties you need as an enum - problem of key value coding is it allows you to type *anything*, typos compile fine. | |
enum SyncObjectPropertyName { | |
case Archived | |
case Title | |
} | |
// Protocol shared both for local and server |
NewerOlder