Skip to content

Instantly share code, notes, and snippets.

//
// Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008
//
// Copyright: See COPYING file that comes with this distribution
//
#ifndef HIGHLIGHTSTATEBUILDER_H_
#define HIGHLIGHTSTATEBUILDER_H_
#include "highlightstate.h"
A libparserutils/build
A libparserutils/build/conv.pl
A libparserutils/build/Aliases
A libparserutils/build/Doxyfile
A libparserutils/build/make-aliases.pl
A libparserutils/test
A libparserutils/test/cscodec-8859.c
A libparserutils/test/regression
A libparserutils/test/regression/filter-badenc-segv.c
A libparserutils/test/regression/stream-nomem.c
@ironfounderson
ironfounderson / gist:751259
Created December 22, 2010 08:16
Loading content from a file contained as a bundle resource within a unit test target
- (NSString *)contentOfXMLFile:(NSString *)filename {
NSString *contentPath = [[NSBundle bundleForClass:[self class]] pathForResource:filename
ofType:@"xml"];
NSURL *contentURL = [NSURL fileURLWithPath:contentPath];
return [NSString stringWithContentsOfURL:contentURL
encoding:NSUTF8StringEncoding
error:nil];
}
@ironfounderson
ironfounderson / gist:751257
Created December 22, 2010 08:06
Loading content from a file contained as a bundle resource
- (NSString *)contentOfXMLFile:(NSString *)filename {
NSString *contentPath = [[NSBundle mainBundle] pathForResource:filename
ofType:@"xml"];
NSURL *contentURL = [NSURL fileURLWithPath:contentPath];
return [NSString stringWithContentsOfURL:contentURL
encoding:NSUTF8StringEncoding
error:nil];
}
@ironfounderson
ironfounderson / gist:661556
Created November 3, 2010 19:26
UIViewController using blocks
@class BookViewController;
typedef void(^BookViewControllerResponse)(BookViewController *controller);
@interface BookViewController : UIViewController {
BookViewControllerResponse cancelBlock_;
BookViewControllerResponse saveBlock_;
}
@property (nonatomic, copy) BookViewControllerResponse cancelBlock;
@ironfounderson
ironfounderson / gist:661555
Created November 3, 2010 19:23
Presenting a modal view controller using blocks
- (void)insertNewObject {
__block NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
Book *newBook = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
BookViewController *bookViewController = [[BookViewController alloc] init];
bookViewController.book = newBook;
__block __typeof__(self) blockSelf = self;
@ironfounderson
ironfounderson / gist:661529
Created November 3, 2010 19:04
Presenting a modal view controller using delegate pattern
- (void)insertNewObject {
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
Book *newBook = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
BookViewController *bookViewController = [[BookViewController alloc] init];
bookViewController.book = newBook;
bookViewController.delegate = self;
[self presentModalViewController:bookViewController animated:YES];
[bookViewController release];
@ironfounderson
ironfounderson / gist:661520
Created November 3, 2010 18:58
UIViewController using a delegate pattern
@class BookViewController;
@protocol BookViewControllerDelegate
- (void)bookViewControllerDidCancel:(BookViewController *)controller;
- (void)bookViewControllerDidSave:(BookViewController *)controller;
@end
@interface BookViewController : UIViewController {
id <BookViewControllerDelegate> delegate_;
}
class EventTimeTest
{
public event EventHandler StandardEvent;
public event EventHandler TrickyEvent = delegate { };
public void Test() {
Stopwatch timer;
EventArgs e = new EventArgs();
for (int testCase = 0; testCase < 9; testCase++) {
int limit = (int)Math.Pow(10, testCase);
// Sample code to remember size and location of a WinForm.
// Needs a Settings class called FormSettings.
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Point location = FormSettings.Default.Location;
if (!StartPositionIsWithinBounds(location))
{
location.X = 10;
location.Y = 10;