Skip to content

Instantly share code, notes, and snippets.

View jfahrenkrug's full-sized avatar

Johannes Fahrenkrug jfahrenkrug

View GitHub Profile
#import "IconCollectionItem.h"
@implementation IconCollectionItem
- (void)doubleClick:(id)sender {
NSLog(@"double click in the collectionItem");
if([self collectionView] && [[self collectionView] delegate] && [[[self collectionView] delegate] respondsToSelector:@selector(doubleClick:)]) {
[[[self collectionView] delegate] performSelector:@selector(doubleClick:) withObject:self];
}
@interface MyViewController : NSViewController <NSCollectionViewDelegate>
{
IBOutlet NSCollectionView *collectionView;
IBOutlet NSArrayController *arrayController;
NSMutableArray *images;
NSUInteger sortingMode;
BOOL alternateColors;
NSArray *savedAlternateColors;
- (void)doubleClick:(id)sender {
NSLog(@"Double clicked on icon: %@", [[sender representedObject] valueForKey:@"name"]);
}
# 2010, Johannes Fahrenkrug, http://springenwerk.com
# Run it like this:
# ruby script/runner clear_diskcache.rb http://mysite.com/some/page http://mysite.com/some/other/page
if ARGV.size < 1
puts "Please supply one or more URLs!"
exit
else
ms = Radiant::Cache::MetaStore.new
ARGV.each do |url|
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
@outlet CPTextField nameTextField;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
@import <Foundation/CPObject.j>
@import <MapKit/MKMapView.j>
@import <MapKit/MKMarker.j>
@import <MapKit/MKLocation.j>
@implementation AppController : CPObject
{
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/oigdrgh286E&hl=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/oigdrgh286E&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
- (void)scaleImage:(float)aScaleFactor
{
//see: http://maettig.com/code/css/css-transform.html
var styleObject = [imageView imageLayer]._DOMContentsElement.style;
if (CPBrowserIsEngine(CPWebKitBrowserEngine) && (typeof styleObject.WebkitTransform != "undefined"))
{
styleObject.WebkitTransform = "scale(" + aScaleFactor + ")";
[[imageView imageLayer] setNeedsDisplay];
}
# in 2010 by Johannes Fahrenkrug, http://springenwerk.com
# See you at WWDC!
require 'rubygems'
require 'open-uri'
class WWDC2010
def self.announced?
title = open('http://developer.apple.com/wwdc') do |f|
f.detect { |line| line =~ /<title>/ }
-(void)drawInContext:(CGContextRef)myContext {
CGContextSaveGState(myContext);// 6
CGFloat potentialFlip = 1.0;
CGFloat shadowBlur = 4;
CGFloat shadowOffset = 4;
CGFloat shadowOffsetNeg = shadowOffset * -1.0;
CGFloat x = self.bounds.origin.x + shadowOffset;
CGFloat y = self.bounds.origin.y + shadowOffset;
CGFloat wd = self.bounds.size.width - (shadowOffset * 2);