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
(defn fibs | |
; this is the doc string | |
"Returns a lazy sequence of all the Fibonacci numbers." | |
; this is the argument list | |
[] | |
; map takes a function and a seq and returns a lazy seq where the function is | |
; applied to each element of the input seq... since it's lazy you can do this | |
; with infinite sequences | |
(map | |
; first is the function argument to map, and it just returns the first element of a collection |
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
- (void)setEditing:(BOOL)editing animated:(BOOL)animated { | |
[super setEditing:editing animated:animated]; | |
[self.tableView reloadData]; | |
} |
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
(import 'java.security.MessageDigest) | |
(defn bytes-str | |
"Does what it says on the tin" | |
[byte-array] | |
(apply str (map #(format "%02x" (bit-and % 0xff)) byte-array))) | |
(defn sha-hash | |
"Returns the SHA hash of string 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 <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main(int argc, char **argv) { | |
if (!isatty(1)) { | |
printf("thanks for piping me, dude\n"); | |
} else { | |
printf("oh good, I'm not piped\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
(defn bytes-used | |
"Returns bytes used by Java VM (after collecting garbage)" | |
[] | |
(let [rt (Runtime/getRuntime)] | |
(dotimes [_ 5] (System/gc)) | |
(- (.totalMemory rt) (.freeMemory rt)))) | |
(defmacro mime | |
"Measures and prints the bytes used while evaluating expr (returns result of expr)" | |
[expr] |
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
BUNDLE="$1" | |
TIMETAG=`date +%y%m%d%H%M` | |
OUT="$2-$TIMETAG.ipa" | |
if [ $# -ne 2 ] || [ ! -d "$BUNDLE" ] | |
then | |
echo 'Usage: mkipa <path_to_app_bundle> <output_ipa_name>' | |
echo 'Example: mkipa build/Distribution\ (Ad\ Hoc)-iphoneos/MyApp.app MyAppAdHoc' | |
else | |
if [ ! -f "$BUNDLE/Entitlements.plist" ] |
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
; creating a seq of prime numbers should *NOT* be this easy! | |
; this has been around since Java 5, apparently | |
(defn prime-seq | |
"Returns a lazy seq of primes (optionally starting from n)" | |
([] (prime-seq 0)) | |
([n] (let [next-prime #(.nextProbablePrime %)] | |
(iterate next-prime (next-prime (bigint 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
#/bin/bash | |
# strings together all of its arguments into a Java classpath, useful for | |
# grabbing all of the jars in a directory like so: | |
# classpath.sh lib/*.jar | |
# | |
DELIM= | |
CLASSPATH= | |
for PATH_PART in "$@" | |
do |
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
var val1 = (new Object()).foo == undefined; // true | |
var undefined = "lol wut"; | |
var val2 = (new Object()).foo == undefined; // false |
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
Process: coreservicesd [45] | |
Path: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Support/coreservicesd | |
Identifier: coreservicesd | |
Version: ??? (???) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [1] | |
Date/Time: 2009-11-09 10:53:22.766 -0500 | |
OS Version: Mac OS X 10.6.1 (10B504) | |
Report Version: 6 |
OlderNewer