Skip to content

Instantly share code, notes, and snippets.

View BlairDuncan's full-sized avatar

Blair Duncan BlairDuncan

  • SGL Studio / BBDO Toronto
  • Toronto, Canada
View GitHub Profile
upArrow = [[CPImage alloc] initWithContentsOfFile:@"Resources/upArrow.png" size:CGSizeMake(8.0, 7.0)];
downArrow = [[CPImage alloc] initWithContentsOfFile:@"Resources/downArrow.png" size:CGSizeMake(8.0, 7.0)];
@implementation CPTableHeaderView (myAdditions)
- (void)mouseDown:(CPEvent)anEvent
{
var selectedColumnNumber = [self columnAtPoint:[self convertPoint:[anEvent locationInWindow] fromView:nil]];
if(selectedColumnNumber == CPNotFound) return;
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
- (void)_updateResizeCursor:(CPEvent)theEvent
{
if(![_tableView allowsColumnResizing] || ![_tableView columnAutoresizingStyle])
{ [[CPCursor arrowCursor] set];
return
}
var mouseLocation = [self convertPoint:[theEvent locationInWindow] fromView:nil],
mouseOverLocation = CGPointMake(mouseLocation.x - 5, mouseLocation.y),
overColumn = [self columnAtPoint:mouseOverLocation];
+ /Users/bduncan/narwhal/packages/narwhal-jsc/src/os-engine.cc
+ /Users/bduncan/narwhal/packages/narwhal-jsc/src/readline.cc
+ /Users/bduncan/narwhal/packages/narwhal-jsc/tests/interpreter-tests.js
Done.
sh configure
No <JavaScriptCore/JavaScript.h> detected. Using <JavaScriptCore/JavaScriptCore.h> instead.
gcc -o lib/libnarwhal.dylib narwhal.c -dynamiclib -0s -force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -arch ppc -Iinclude -framework JavaScriptCore -lreadline
mkdir -p `dirname bin/narwhal-webkit`
gcc -o bin/narwhal-webkit -DWEBKIT -x objective-c narwhal-jsc.c -0s -force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -arch ppc -Iinclude -framework JavaScriptCore -L/usr/lib -lreadline -liconv -Llib -lnarwhal \
-framework Foundation -framework WebKit
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
@outlet CPWindow theWindow; //this "outlet" is connected automatically by the Cib
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
@implementation CPString(htmlentities)
+ (CPString)stripHtmlEntites:(CPString)aString
{
//FIXME currently only supports decimal entities
// alert([CPString stringWithoutHtmlEntites:@"Montr&#233;al"]);
//alert([CPString stringWithoutHtmlEntites:@"Montr&eacute;al"]);
var matches = aString.match(/&#\d+;?/g);
if(matches)
for(var i = 0; i < matches.length; i++)
-(CPURLRequest)createFindRequestWithIdentifier:(BOOL)useIndentifier
{
var userID = [userID_TextField stringValue];
var userPW = [userPW_TextField stringValue];
var content = [[CPString alloc] initWithFormat:@"userID=%@&userPW=%@",
[userID urlencode],
[userPW urlencode]];
var contentLength = [[CPString alloc] initWithFormat:@"%d", [content length]];
- (void)collapseItem:(id)anItem
{
if (!anItem)
return;
var itemInfo = _itemInfosForItems[[anItem UID]];
if (!itemInfo)
return;
var tempSaveSelections = Nil;
- (void)saveOutlineSelections
{
var rows = [outlineView selectedRowIndexes],
dataSet = outlineView._itemsForRows;
tempSaveSelections = [dataSet objectsAtIndexes:rows];
// add the current selection at the end for later restore
- (CGRect)frameOfOutlineDataViewAtRow:(CPInteger)aRow
{
// the cocoa docs says it returns a zeroRect if not expandable which makes no sence
// if(! [self isExpandable:[self itemAtRow:aRow]]) return CGRectMakeZero();
var aColumn = [[self tableColumns] indexOfObjectIdenticalTo:[self outlineTableColumn]]
frame = [super frameOfDataViewAtColumn:aColumn row:aRow],
indentationWidth = ([self levelForRow:aRow] + 1) * [self indentationPerLevel];