This file contains 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/env perl | |
use Modern::Perl; | |
use HTTP::Proxy; | |
use HTTP::Proxy::HeaderFilter::simple; | |
my $proxy = HTTP::Proxy->new(host => undef, port => 3128); | |
my $filter = HTTP::Proxy::HeaderFilter::simple->new(sub | |
{ | |
my ($self, $headers, $message) = @_; |
This file contains 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
// Runs given block. Returns YES if some object of class ‘c’ | |
// was deallocated in the block. Not thread-safe. | |
BOOL classGetsDeallocated(Class c, void (^block)(void)); | |
// Convenience interface that calls the function above. | |
// Releases object, returns YES if object was deallocated. | |
BOOL getsDeallocatedByReleasing(id object); |
This file contains 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 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 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 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 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 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 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/env perl | |
use v5.14; | |
use strict; | |
use warnings; | |
use Data::Dump 'pp'; | |
{ | |
package Node; | |
use Mouse; |