Skip to content

Instantly share code, notes, and snippets.

View tolmasky's full-sized avatar

Francisco Ryan Tolmasky I tolmasky

View GitHub Profile
var button = [CPButton buttonWithTitle:@"hello"];
var undoManager = [[CPUndoManager alloc] init];
[undoManager observeChangesForKeyPath:"title" ofObject:button];
[button setTitle:"a Btn Title"];
console.error([undoManager canUndo]); // prints true for me
<script>
function how_long(name, func)
{
var start = new Date();
func();
var end = new Date();
console.log(name + " took: " + (end - start) + "ms");
}
<script>
var array = [],
array2 = [],
array3 = [];
var TOTAL = 100000;
var x = 0;
//with(x){
for (i = 0; i < TOTAL; ++i)
array[i] = i;
var SYSTEM = require('system'),
HTTP = require('http-client');
if (SYSTEM.args.length < 2)
{
print("usage:");
print("js " + SYSTEM.args[0] + " <fileformat.info URL>+");
require("os").exit(1);
}
/*
* CFBundle.js
* Objective-J
*
* Created by Francisco Tolmasky.
* Copyright 2008-2010, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
/*
* CFHTTPRequest.js
* Objective-J
*
* Created by Francisco Tolmasky.
* Copyright 2010, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
// Any character in the Unicode categories "Uppercase letter (Lu)",
// "Lowercase letter (Ll)", "Titlecase letter (Lt)", "Modifier letter (Lm)",
// "Other letter (Lo)", or "Letter number (Nl)".
// http://www.fileformat.info/info/unicode/category/Lu/list.htm
// http://www.fileformat.info/info/unicode/category/Ll/list.htm
// http://www.fileformat.info/info/unicode/category/Lt/list.htm
// http://www.fileformat.info/info/unicode/category/Lm/list.htm
// http://www.fileformat.info/info/unicode/category/Lo/list.htm
// http://www.fileformat.info/info/unicode/category/Nl/list.htm
UnicodeLetter = [\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u01
function evaluate(context, parent, rules, rule_id)
{
var rule = rules[rule_id],
type = rule[0],
input_length = context.input.length,
memos = context.memos[rule_id];
var uid = context.position,
entry = memos[uid];
if (entry === false)
return false;
Block =
"{" _ StatementList? _ "}"
Identifier =
!(ReservedWord !IdentifierPart) IdentifierName
Identifier =
!(ReservedWord !IdentifierPart) IdentifierName %
BadIdentifier
BadIdentifier <Reserved words can't be identifiers> =
ReservedWord !IdentifierPart