Skip to content

Instantly share code, notes, and snippets.

View angerman's full-sized avatar
🇸🇬

Moritz Angermann angerman

🇸🇬
View GitHub Profile
/*
* AppController.j
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/CPObject.j>
@import "Checkbox.j"
@implementation ZebraList : CPCollectionView
{
CPView _backgroundFrame;
}
+ (void)initialize
{
backgroundImage = [[CPImage alloc] initWithContentsOfFile: "Resources/ZebraList/bg.png" size: CPSizeMake(1, 40)];
}
-(id)initWithFrame:(CPRect)frame
{
/* -*- coding: utf-8 -*-
*
* Starrater with a revised version from boucher from 280North
*/
@import <AppKit/CPControl.j>
@import <AppKit/CPImage.j>
var starEmpty = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/empty.gif" size: CPSizeMake(25, 25)],
starSet = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/set.gif" size: CPSizeMake(25, 25)],
/* -*- coding: utf-8 -*-
*
* Starrater with a revised version from boucher from 280North
*/
@import <AppKit/CPControl.j>
@import <AppKit/CPImage.j>
var starEmpty = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/empty.gif" size: CPSizeMake(25, 25)],
starSet = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/set.gif" size: CPSizeMake(25, 25)],
/* -*- coding: utf-8 -*-
*
* Starrater with a revised version from boucher from 280North
*/
@import <AppKit/CPControl.j>
@import <AppKit/CPImage.j>
var starEmpty = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/empty.gif" size: CPSizeMake(25, 25)],
starSet = [[CPImage alloc] initWithContentsOfFile: "Resources/StarRater/set.gif" size: CPSizeMake(25, 25)],
/*
* AppController.j
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/CPObject.j>
@import "StarRatingView.j"
/* -*- coding: utf-8 -*-
* Created by Moritz Angermann on 6. March 2009.
* Copyright 2009 Moritz Angermann. All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
-- replace onward from line 429 of CPTextField
element.onblur = function ()
{
console.log("blur start");
[self setObjectValue:element.value];
[self sendAction:[self action] to:[self target]];
[[self window] makeFirstResponder:nil];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
console.log("blur end");
@angerman
angerman / gist:77392
Created March 11, 2009 09:55
fixing the event queue for the CPTextField
diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j
index 40ac8c5..d83c0e0 100644
--- a/AppKit/CPTextField.j
+++ b/AppKit/CPTextField.j
@@ -129,6 +129,7 @@ var _CPTextFieldSquareBezelColor = nil,
if (!CPTextFieldDOMInputElement)
{
CPTextFieldDOMInputElement = document.createElement("input");
+ CPTextFieldDOMInputElement.isActive = NO;
CPTextFieldDOMInputElement.style.position = "absolute";
let rec map f x y =
match (x,y) with
([],_) | (_,[]) -> failwith "list do not have same length"
| ([a],[b]) -> [f a b]
| (h1::t1,h2::t2) -> (f h1 h2)::(map f t1 t2)
;; (* map *)
open Printf;;
Printf.printf "%d\n" (map (fun x y -> x * y) [1;2;3;4;5] [1;2;3;4;5]);;