Skip to content

Instantly share code, notes, and snippets.

View nickjs's full-sized avatar

Nicholas J. Small nickjs

View GitHub Profile
var SharedController;
@implementation MyController : CPObject
{
}
+ (MyController)sharedController
{
if (!SharedController)
@nickjs
nickjs / gist:576724
Created September 13, 2010 02:32 — forked from anonymous/gist:576694
@import <Foundation/CPObject.j>
@import "../Models/MenuItem.j"
@import "../Views/AccountsWindow.j"
@implementation MainMenuController : CPObject
{
CPView _mainView;
CPString _username;
MenuItem mainMenu @accessors;
function dateFromRailsAPI(aString){
if (!aString)
return;
var regexp = /(\d\d\d\d)(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/,
matches = aString.match(new RegExp(regexp)),
offset = 0,
date = new Date();
if (matches)
diff --git a/AppKit/CPArrayController.j b/AppKit/CPArrayController.j
index 5fefb58..729b937 100644
--- a/AppKit/CPArrayController.j
+++ b/AppKit/CPArrayController.j
@@ -334,8 +334,12 @@
- (CPArray)selectedObjects
{
var objects = [[self arrangedObjects] objectsAtIndexes:[self selectionIndexes]];
+ if (objects)
+ objects = [_CPObservableArray arrayWithArray:objects];
/*
* NavigationCell.j
* DesktopShop
*
* Created by Nicholas Small on February 2, 2010.
* Copyright 2010, JadedPixel, Inc. All rights reserved.
*/
@import <AppKit/CPView.j>
var SharedController;
@implementation MyWindowController : CPWindowController
{
}
+ (id)sharedController
{
if (!SharedController)
SharedController = [[self alloc] init];
/*
* Jakefile
* Shopify - com.shopify.Text.plugin
*
* Created by Nicholas Small on January 31, 2010.
* Copyright 2010, JadedPixel, Inc. All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CPBundleIdentifier</key>
<string>com.shopify.Text.plugin</string>
<key>CPBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CPBundleName</key>
<string>Text.plugin</string>
@nickjs
nickjs / CPUserDefaults.j
Created November 20, 2009 23:18
CPUserDefaults
/*
* CPUserDefaults.j
* AppKit
*
* Created by Nicholas Small.
* Copyright 2009, 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
@nickjs
nickjs / CPMenuItem.diff
Created July 31, 2009 21:03
Monkey Patches
diff --git a/AppKit/CPMenuItem.j b/AppKit/CPMenuItem.j
index b738729..c71f259 100644
--- a/AppKit/CPMenuItem.j
+++ b/AppKit/CPMenuItem.j
@@ -78,6 +78,27 @@
_CPMenuItemView _menuItemView;
}
+- (id)init
+{