This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Modern::Perl; | |
use Benchmark 'cmpthese'; | |
sub with_eval | |
{ | |
eval | |
{ | |
my ($a, $b) = (2, 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package REPL; | |
use Modern::Perl; | |
use Moose; | |
sub foo | |
{ | |
return "foo"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- Trivial wrapper around system sound as provided by Audio Services. | |
- Don’t forget to link against the Audio Toolbox framework. | |
- Assumes ARC support. | |
*/ | |
@interface Sound : NSObject | |
// Path is relative to the resources dir. | |
- (id) initWithPath: (NSString*) path; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Modern::Perl; | |
use XML::RSS::Tools; | |
use Perl6::Slurp; | |
my $style = slurp \*DATA; | |
my $feed = XML::RSS::Tools->new; | |
#$feed->set_http_client('lite'); | |
#$feed->debug(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Modern::Perl; | |
use WWW::Mechanize; | |
my $root = 'http://naima:3000/cs/'; | |
my $domain = 'http://naima'; | |
my $mech = WWW::Mechanize->new; | |
sub visit { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) processStrings: (NSString*) str1, ... | |
{ | |
va_list args; | |
va_start(args, str1); | |
NSString *arg = str1; | |
while (arg != nil) { | |
// do something with arg | |
arg = va_arg(args, NSString*); | |
} | |
va_end(args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef enum { | |
kDeviceTypeUnknown = 0, | |
kDeviceTypeSimulator, | |
kDeviceTypeiPhone1G, | |
kDeviceTypeiPhone3G, | |
kDeviceTypeiPhone3GS, | |
kDeviceTypeiPhone4, | |
kDeviceTypeiPod1G, | |
kDeviceTypeiPod2G, | |
kDeviceTypeiPad |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface DownloadOperation : NSOperation | |
{ | |
NSURLRequest *request; | |
NSURLConnection *connection; | |
NSMutableData *receivedData; | |
} | |
@property(readonly) BOOL isExecuting; | |
@property(readonly) BOOL isFinished; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIImage (ForceLoading) | |
- (void) forceLoad | |
{ | |
const CGImageRef cgImage = [self CGImage]; | |
const int width = CGImageGetWidth(cgImage); | |
const int height = CGImageGetHeight(cgImage); | |
const CGColorSpaceRef colorspace = CGImageGetColorSpace(cgImage); |
OlderNewer