Skip to content

Instantly share code, notes, and snippets.

View kriskowal's full-sized avatar

Kris Kowal kriskowal

View GitHub Profile
golf () {
echo ip: $1;
echo -n "A: "
perl -e '$p=qr!(?:0|1\d{0,2}|2(?:[0-4]\d?|5[0-5]?|[6-9])?|[3-9]\d?)!;print((shift=~m/^$p\.$p\.$p\.$p$/)?1:0);' $1; echo
echo -n "B: "
perl -e '$p=qr!(?:0|1\d{0,2}|2(?:[0-4]\d?|5[0-5]?|[6-9])?|[3-9]\d?)!;exit shift !~ m/^$p\.$p\.$p\.$p$/;' $1 && echo pass || echo fail
echo -n "C: "
perl -e '$p=qr{(?:0|1\d{0,2}|2(?:[0-4]\d?|5[0-5]?|[6-9])?|[3-9]\d?)};exit shift !~ m/^$p\.$p\.$p\.$p$/;' $1 && echo pass || echo fail
echo -n "D: "
{
"dependencies": [
[
"nr-devtools",
{
"catalog": "http://github.com/cadorn/narwhalrunner/raw/master/catalog.json",
"name": "devtools",
"revision": "latest"
}
],
diff --git a/README.md b/README.md
index 080765b..39dfd00 100644
--- a/README.md
+++ b/README.md
@@ -59,6 +59,7 @@ Contributors
* [Isaac Z. Schlueter](http://blog.izs.me/)
* [Kris Zyp](http://www.sitepen.com/blog/author/kzyp/)
* [Nathan Stott](http://nathan.whiteboard-it.com/)
+* [Toby Ho](http://tobyho.com)
diff --git a/engines/rhino/bootstrap.js b/engines/rhino/bootstrap.js
index 6532a41..1af8f57 100644
--- a/engines/rhino/bootstrap.js
+++ b/engines/rhino/bootstrap.js
@@ -89,28 +89,30 @@
try {
narwhal({
- global: global,
- evalGlobal: evalGlobal,
kris@imoo:~/narwhal integration $ tusk create-catalog
TypeError: Cannot find function decode in object [object Object].
org.mozilla.javascript.EcmaError: TypeError: Cannot find function decode in object [object Object]. (/Users/kris/narwhal/lib/narwhal/tusk.js#118)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3759)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3778)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3842)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2343)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2310)
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
diff --git a/bin/.gitignore b/bin/.gitignore
deleted file mode 100644
index 4761b63..0000000
--- a/bin/.gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-*
exports.getC = function () {
return c;
};
var c = require("./c");
application.end = function(){
sys.puts('application end');
application.saveState(true);
};
application.saveState = function(shutdown){
sys.puts('application saveState');
//dump data.json into application state
var mode = 0444;
var x = posix.open(application.dataPath ,process.O_RDWR|process.O_TRUNC,0444).addCallback(function(fd){
// require, exports, and module are injected automatically
// a and b had to be injected explicitly
var UTIL = require("util");
exports.result = UTIL.add(a, b);
(function (exports) {
// because the anonymous function is being called without a scope being set,
// "this" will refer to the global scope. In a browser, that's the window, but
// will be "undefined" in strict mode. In other JS platforms, it may be some
// other thing.
// my code here.
// don't make accidental globals.
// hang a small number of things on the "exports" object.