Skip to content

Instantly share code, notes, and snippets.

View jarek-foksa's full-sized avatar

Jarek Foksa jarek-foksa

View GitHub Profile
global.events = {};
//
// Usage:
// bind('editButton->clicked', function(arg) {
// doStuff(arg);
// });
//
global.bind = function(eventName, callback) {
Object.new = function(arg) {
var property;
var prototype = arg.__prototype__ || object;
var object = Object.create(prototype);
for (property in arg) {
if (arg.hasOwnProperty(property)) {
object[property] = arg[property];
}
}
//
// "Framework"
//
window.object = Object.prototype;
Object.define = function(arg) {
var prototype = arg.__prototype__ || Object.prototype;
var object = Object.create(prototype);
var property;
Storage.prototype.set = (item, value) ->
@setItem item, JSON.stringify value
Storage.prototype.get = (item) ->
return JSON.parse @getItem(item)
Object.makeNonEnumerable Storage.prototype, ['set', 'get']
# "Framework"
Object.define = (arg) ->
prototype = arg.__prototype__ || Object.prototype
object = Object.create prototype
for property of arg
if arg.hasOwnProperty property
object[property] = arg[property]
delete object.__prototype__
# prototypes
dialog = __super__ = imports('/widgets/dialog.coffee').dialog
resetButton = imports('/toolbar/reset-button.coffee').resetButton
pauseButton = imports('/toolbar/pause-button.coffee').pauseButton
skipButton = imports('/toolbar/skip-button.coffee').skipButton
infobox = imports('/toolbar/infobox.coffee').infobox
speedChartButton = imports('/toolbar/speed-chart-button.coffee').speedChartButton
accuracyChartButton = imports('/toolbar/accuracy-chart-button.coffee').accuracyChartButton
mostTypedButton = imports('/toolbar/most-typed-button.coffee').mostTypedButton
window.addEventListener('DOMContentLoaded', function() {
window.addEventListener('load', function() {
console.log('all loaded');
});
});
#import "MainWindowController.h"
#import <WebKit2/WKProcessGroup.h>
#import <WebKit2/WKBrowsingContextGroup.h>
#import <WebKit2/WebKit2.h>
#import <WebKit2/WKPreferencesPrivate.h>
#import <WebKit2/WKPageGroup.h>
spawnCocoaProcess: ->
workingDirPath = process.argv[3]
execPath = workingDirPath + '/Type Fu'
env = process.env
env['DYLD_FRAMEWORK_PATH'] = workingDirPath + '/../Frameworks'
env['WEBKIT_UNSET_DYLD_FRAMEWORK_PATH'] = 'YES'
nodeProcess = process
cocoaProcess = spawn execPath, [client.port],
@implementation MySingleton
static MySingleton* _instance = nil;
+(id)alloc {
@synchronized([MySingleton class]) {
NSAssert(_instance == nil, @"Error. Don't use alloc on singloetons.");
_instance = [super alloc];
return _instance;
}