Skip to content

Instantly share code, notes, and snippets.

Nathan Ostgard noonat

Block or report user

Report or block noonat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View PhuceContext.h
#import <UIKit/UIKit.h>
namespace PhuceContext {
// state (
bool save();
bool restore();
// transformations (
noonat / build.patch
Created Jun 3, 2010
SpiderMonkey on iPhone
View build.patch
--- config/ 2010-06-05 19:06:36.000000000 -0700
+++ config/ 2010-06-05 19:06:59.000000000 -0700
@@ -97,7 +97,6 @@
noonat / jquery.replaceClasses.js
Created May 12, 2010
jQuery replace classes
View jquery.replaceClasses.js
// Removes all classes beginning with prefix, and replaces them
// with a prefix+suffix class. For example:
// $('#blah').addClass('foobaz');
// $('#blah').replaceClasses('foo', 'baz');
jQuery.fn.replaceClasses = function(prefix, suffix) {
var re = new RegExp('^' + prefix);
return this.each(function() {
var classes = this.className.split(/\s+/);
var newClasses = [];
var i = classes.length;
noonat / machine.js
Created May 7, 2010
JavaScript state machine
View machine.js
// Javascript state machine. Allows you to specify a number of routes
// and set a target state, and it will call through the routes to
// get there.
function Machine(defaultState, routes) { = undefined;
this.transition = undefined;
this.routes = typeof routes === 'function' ? routes() : routes;
// Set the state last, so the route will be triggered.
noonat / events.js
Created Apr 16, 2010
Rhino event loop
View events.js
function EventEmitter() {
this._listeners = {};
exports.EventEmitter = EventEmitter;
EventEmitter.prototype.listeners = function(event) {
if (!this._listeners[event]) {
this._listeners[event] = [];
return this._listeners[event];
noonat /
Created Apr 7, 2010
Checkout and build Rhino
# I hope I never have to remember how to do this ever again
if ! [ -d mozilla ]; then
noonat / jspec.junit.js
Created Nov 14, 2009 — forked from tj/jspec.junit.js
JUnit XML output for JSpec
View jspec.junit.js
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="" tests="2" assertions="2" failures="0" specs="2">
<testcase name="should be an instance of QueuedEventPool" assertions="1"/>
<testcase name="should have the correct name" assertions="1"/>
noonat / rhino_ast.rb
Created Nov 14, 2009
Parse a JS file using JRuby and Rhino and print the AST
View rhino_ast.rb
require 'js-1_7r3.jar'
import Java::OrgMozillaJavascript::Context
import Java::OrgMozillaJavascript::CompilerEnvirons
import Java::OrgMozillaJavascript::Parser
import Java::OrgMozillaJavascript::Token
class Visitor
include Java::OrgMozillaJavascriptAst::NodeVisitor

Keybase proof

I hereby claim:

  • I am noonat on github.
  • I am noonat ( on keybase.
  • I have a public key whose fingerprint is 280C D0D7 B06E ACF3 FD86 058A 0905 62AD 94AC 5A83

To claim this, I am signing this object:

View ruby-accessors.mkdn

Understanding Accessor Methods in Ruby

Accessing properties of an object in Ruby are a bit different than they are in JavaScript. In JavaScript, if you defined an object constructor like so:

function Foo() {
  this.x = 1;
  this.y = 2;
You can’t perform that action at this time.