Skip to content

Instantly share code, notes, and snippets.

// These classese should be treated as immutable
@interface MWAttributedString : NSObject <NSCoding>
- (id)initWithAttributedString:(NSAttributedString *)string;
- (NSAttributedString *)attributedString;
@end
From a past Bath CS exam paper, thanks James Potter!
Scotland declares independence, secures an opt-out from the EU directive,
and makes "sales of drugs into Scotland" illegal.
This worries the Boss, who enjoys grouse-shooting in Scotland,
so he orders you to detect all IP connections to the "Drugs'R'Us" web site from Scotland.
Fortunately, the Scottish Parliament has also passed a law saying that all computers in Scotland
must either be in the new .hg (for Haggisland) domain, or at least contain hg in their domain name.
Write a memorandum to the Boss explaining what you can and cannot do, and what change to the clause
quoted above of the Scottish drugs law would make his grouse-shooting safer.
 <form>
     Username: <input type=text name=username value=<?php echo htmlspecialchars($_GET['name'], ENT_QUOTES, 'UTF-8'); ?> />
   </form>
@interface Person : NSObject
@property (nonatomic, copy) NSString *name;
@end
@pita5
pita5 / def
Created January 23, 2012 17:41
#ifndef MAYBE
#define MAYBE (BOOL)2
#endif
- (void)setAttributedString:(CFAttributedStringRef)attributedString
{
__block MWMutableFrame *blockSelf = self;
dispatch_barrier_sync(_lockQueue, ^{
if (_attributedString == attributedString) return;
if (_attributedString)
{
CFRelease(_attributedString);
CTFontRef CreateBoldFont(CTFontRef iFont, Boolean iMakeBold)
{
CTFontSymbolicTraits desiredTrait = 0;
CTFontSymbolicTraits traitMask;
if (iMakeBold)
desiredTrait = kCTFontBoldTrait;
traitMask = kCTFontBoldTrait;
@pita5
pita5 / asd
Created February 2, 2012 13:47
asdasd
/*
File: PhotoViewController.h
Abstract: Configures and displays the paging scroll view and handles tiling and page configuration.
Version: 1.1
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
CGContextSaveGState(context);
{
// Something something
}
CGContextRestoreGState(context);
self.ak = [AKViewController aurasmaViewControllerWithDelegate:self];
ak.delayGuide = YES;
[self presentModalViewController:ak animated:NO];
[ak presentOverlayViewController:[[MWTestOverlayVC alloc] initWithNibName:nil bundle:nil]
animated:NO];