This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @events | |
// press | |
// release | |
var Button = registerElement("x-button", { | |
// @pragma mark model ----------------------------------------------------------------------- | |
// Leading "&" means that the property is bound to attribute and that it will fire | |
// <propertyName>ChangedCallback() each time when either attribute or property is changed | |
// and the callback exists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class NotificationCenter { | |
func addObserver(name: String, object: AnyObject, callback: (NSDictionary) -> Void ) -> NSObjectProtocol { | |
var observer : NSObjectProtocol = NSNotificationCenter.defaultCenter().addObserverForName(name, object: object, queue: nil, usingBlock: { | |
(notification : NSNotification!) in | |
callback(notification.userInfo) | |
}) | |
return observer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
class MainMenuController : NSObject, NSMenuDelegate { | |
init() { | |
} | |
private func forEach(callback: (NSMenuItem)->()) { | |
func walk(menu: NSMenu) { | |
for item in menu.itemArray { | |
callback(item as NSMenuItem) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @info | |
// Asynchronously iterate over each item of an array or an array-like object. | |
// The order in which items are iterated is guaranteed to match array order. | |
var iterateSeries = function (array, iterator, callback) { | |
array = Array.prototype.slice.call(array, 0); | |
if (array.length === 0) { | |
if (callback) callback(); | |
} | |
else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var space = { | |
id: "editor-1", | |
label: "Untitled", | |
type: "editor", | |
url: "frontend/editor.xhtml", | |
fileName: null, | |
loaded: false, | |
load() { editor.laod(...) } | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class EventEmitter { | |
var _events : Dictionary<String, Dictionary<Int, (event: Any)->()>?> = [:] | |
var _eventsCounter : Int = 0 | |
func addEventListener(eventName: String, listener: (event: Any) -> ()) -> (Int) { | |
_eventsCounter += 1 | |
var optionalListeners = _events[eventName] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "BXWindow.h" | |
#import "INAppStoreWindow.h" | |
#import "INWindowButton.h" | |
#import "NSColor+hex.h" | |
@implementation BXWindow | |
-(void)awakeFromNib { | |
self.titleBarHeight = 24.0; | |
self.trafficLightButtonsLeftMargin = 8.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://svg-whiz.com/svg/starPrimative.svg | |
drawNGon: (cx, cy, r, rCorner, arms, shift = 0) -> | |
polyPoints = '' | |
if arms in [1,3,5,7,9] | |
orient = 'point' | |
else | |
orient = 'edge' | |
for s in [0..arms] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://svg-whiz.com/svg/starPrimative.svg | |
# Smoothing: http://www.codeproject.com/Articles/128705/WPF-rounded-corners-polygon | |
drawStar: (cx, cy, r1, r2, rCorner, arms, shift = 0) -> | |
polyPoints = null | |
segments = [] | |
if arms in [1,3,5,7,9] | |
orient = 'point' | |
else | |
orient = 'edge' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RectShape = | |
$element: null | |
width: 100 | |
height: 100 | |
x: 0 | |
y: 0 | |
r1: 0 # top left | |
r2: 0 # top right | |
r3: 0 # bottom left |