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
| An Application may not download or install executable code. Interpreted code may only | |
| be used in an Application if all scripts, code and interpreters are packaged in the Application and | |
| not downloaded. The only exception to the foregoing is scripts and code downloaded and run by | |
| Apple's built-in WebKit framework. |
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 memoize* | |
| "Like clojure.core/memoize, but the returned function's metadata contains an :invalidate function which completely resets the memory in the 0-ary form, or accepts the argument sequence for which to invalidate as its only argument." | |
| [f] | |
| (let [memo (atom {})] | |
| (with-meta | |
| (fn memoized [& args] | |
| (if-let [e (find @memo args)] | |
| (val e) | |
| (let [ret (apply f args)] | |
| (swap! memo assoc args ret) |
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
| // macro for declaring members with C++ types in Objective-C++ classes which should be #import-able by Objective-C | |
| #ifdef __cplusplus | |
| #define CPPCLASS(ns, cname) ns :: cname | |
| #else | |
| #define CPPCLASS(ns, cname) struct CPP_ ## ns ## _ ## cname | |
| #endif | |
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> | |
| class A | |
| { | |
| int answer; | |
| public: | |
| A(int answer) : | |
| answer(answer) | |
| { | |
| printf("%i\n", answer); |
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
| /** | |
| * Runs the given function while locking (synchronising on) the specified object. | |
| * | |
| * This uses Rhino's sync() function, but is a lot more flexible, allowing | |
| * unbound functions and closures. May of course be nested, but beware of deadlocks. | |
| * @param {Object} obj JavaScript object to be locked. | |
| * @param {Function} fn The function to call from within a synchronised block. | |
| * @param [args...] Any number of additional arguments to pass to fn. | |
| * @returns The value returned from calling fn. | |
| * |
NewerOlder