Skip to content

Instantly share code, notes, and snippets.

View tolmasky's full-sized avatar

Francisco Ryan Tolmasky I tolmasky

View GitHub Profile
[importButton setBordered:NO];
[importButton setImagePosition:CPImageLeft];
[importButton setTitle:@"blah"];
[importButton setTextColor:[CPColor blackColor]];
[importButton setFont:[CPFont systemFontOfSize:16.0]];
[importButton setImage:[[CPImage alloc] initWithContentsOfFile:path1 size:CGSizeMake(32.0, 32.0)]];
[importButton setAlternateImage:[[CPImage alloc] initWithContentsOfFile:path2 size:CGSizeMake(32.0, 32.0)]];
[importButton setAlignment:CPLeftTextAlignment];
[importButton setDelegate:self];
@implementation TheCell : CPView
{
id myRepresentedObject
}
- (void)mouseDragged:(CPEvent)anEvent
{
var dragView = [[TheCell alloc] initWithFrame:[self bounds]];
[dragView setRepresentedObject:myRepresentedObject];
- (CPString)stringByDeletingLastPathComponent
{
var path = self,
start = length - 1;
while (path.charAt(start) === '/')
start--;
path = path.substr(0, path.lastIndexOf('/', start));
for(; index < count; ++index)
{
var lhs = self[index],
rhs = anArray[index];
if (lhs !== rhs && (!lhs.isa || !rhs.isa || ![lhs isEqual:rhs]))
return NO;
}
for(; index < count; ++index)
{
var lhs = self[index],
rhs = anArray[index];
if (lhs === rhs || lhs.isa && rhs.isa && [lhs isEqual:rhs])
continue;
return NO;
}
--- a/Foundation/CPTimer.j
+++ b/Foundation/CPTimer.j
@@ -243,13 +243,13 @@ var _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functio
theFunction = nil;
if (typeof codeOrFunction === "string")
- theFunction = function() { new Function(codeOrFunction)(); CPTimersForTimeoutIDs[timeoutID] = nil; }
+ theFunction = function() { new Function(codeOrFunction)(); if (!shouldRepeat) CPTimersForTimeoutIDs[timeoutID] = nil; }
else
{
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Name</key>
<string>YouKit</string>
<key>Targets</key>
<array>
<dict>
<key>Name</key>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CPBundleIdentifier</key>
<string>com.You.YouKit</string>
<key>CPBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CPBundleName</key>
<string>YouKit</string>
<script>
window.setTimeout(function() { alert(); window.setTimeout(alert(), 100); }, 100);
window.setTimeout(function() { alert(); window.setTimeout(alert(), 100); }, 100);
alert();
</script>
@implementation Shape : CPObject
{
CGRect mRect;
CPColor mColor;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeRect:mRect forKey:"rect"];
[aCoder encodeObject:mColor forKey:"color"];