Skip to content

Instantly share code, notes, and snippets.

@cacaodev
cacaodev / kiwibug1.j
Last active May 23, 2017 18:31
kiwi Strength bug
var priority = function(p)
{
return kiwi.Strength.create(0, 1, 0, p);
};
var kiwi = require("kiwi.js")
var solver = new kiwi.Solver();
var width = new kiwi.Variable("width");
var widthExp = new kiwi.Expression(width);
var antiCompression = new kiwi.Constraint(widthExp, kiwi.Operator.Ge, 100, priority(510));
@cacaodev
cacaodev / Narwhal-node.txt
Created April 3, 2017 08:51
Narwhal-node
macminiduo:cappuccino romain$ jake
(in /Volumes/GAMMA/DEVELOPPEMENT/cacaodev/cappuccino)
(in /Volumes/GAMMA/DEVELOPPEMENT/cacaodev/cappuccino)
setupEnvironment warning: SyntaxError: Unexpected token )
(in /Volumes/GAMMA/DEVELOPPEMENT/cacaodev/cappuccino/Objective-J)
setupEnvironment warning: SyntaxError: Unexpected token )
Building... /Volumes/GAMMA/DEVELOPPEMENT/BUILDS/CAPPUCCINO/Release/Objective-J/Objective-J.js
Throw caught by top level try in narwhal-node/bootstrap.js
Error: BufCache.next(n) only takes positive numbers. n is 0
/Volumes/GAMMA/DEVELOPPEMENT/cacaodev/narwhal/node_modules/synchronize/sync.js:114
@implementation NSTreeController
- (id)initWithCoder:(id)
//id __cdecl -[NSTreeController initWithCoder:](struct NSTreeController *self, SEL a2, id a3)
{
void *v3; // esi@1
void *v4; // eax@2
void *v5; // eax@2
void *v6; // eax@2
void *v7; // eax@2
@cacaodev
cacaodev / CPViewAnimator.j
Created November 2, 2016 09:57
Ask the animator if he wants frame updates for a given key path
- (id)initWithTarget:(id)aTarget
{
self = [super initWithTarget:aTarget];
_wantsPeriodicFrameUpdates = NO;
return self;
}
- (void)requestPeriodicFrameUpdates
var CSSStringFromCGAffineTransform = function(anAffineTransform)
{
// Firefox : add px to the translate values.
return "matrix(" + anAffineTransform.a + ", " + anAffineTransform.b + ", " + anAffineTransform.c + ", " + anAffineTransform.d + ", " + anAffineTransform.tx + ", " + anAffineTransform.ty + ")";
};
var frameOriginToCSSTransformMatrix = function(start, current)
{
var affine = CGAffineTransformMakeTranslation(current.x - start.x, current.y - start.y);
@cacaodev
cacaodev / CPAutosizeTest
Created April 12, 2014 06:27
Cappuccino: autosize perf / autoresizeMask
@import <AppKit/AppKit.j>
@import <Foundation/Foundation.j>
[CPApplication sharedApplication];
@implementation CPAutosizeTest : OJTestCase
{
CPInteger NUMBER_OF_VIEWS;
CPInteger RESIZES_COUNT;
@cacaodev
cacaodev / CPCollectionView -setItemPrototype:
Last active December 14, 2015 16:29
CPCollectionView -setItemPrototype: documentation
Sets the item prototype to \c anItem.
If the item prototype view is located in an external cib file, then the representedObject, outlets and bindings will be automatically restored when an item is created.
If the prototype item view belong to the same cib as the collection view, then the item prototype should implement the CPCoding protocol
because the item is copied by archiving and unarchiving the
prototypal view.
Bindings won't be restored throught archiving, instead you need to subclass the -representedObject: method and update the view there.
@cacaodev
cacaodev / cocoa_binders
Created July 3, 2012 13:47
cocoa binders & bindings
NSColorPanelColorWell
NSDisplayFontBinder:NSBinder: font,fontSize,fontName,fontFamilyName,fontItalic,fontBold
NSEditableBinder:NSBinder: enabled,hidden
NSObjectParameterBinder:NSBinder: toolTip
NSValueBinder:NSEditorBinder:NSBinder: value
NSStepper
@cacaodev
cacaodev / -valueForKey:
Created December 19, 2010 20:29
Return a KVC proxy if the receiver implements -countOfKey AND objectInKeyAtIndex:
- (id)valueForKey:(CPString)aKey
{
var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substring(1),
objectAtIndexSEL = sel_getName(@"objectIn" + capitalizedKey + "AtIndex:"),
objectsAtIndexesSEL = sel_getName(aKey + "AtIndexes:"),
countSEL = sel_getName(@"countOf" + capitalizedKey);
if ([destination respondsToSelector:countSEL] && ([destination respondsToSelector:objectAtIndexSEL] || [destination respondsToSelector:objectsAtIndexesSEL]))
return [destination mutableArrayValueForKey:aKey];
@cacaodev
cacaodev / Variable row height
Created December 1, 2010 22:03
Test live variable row height in CPtableView
/*
* AppController.j
* TestTemplate
*
* Created by You on August 10, 2010.
* Copyright 2010, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>