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
// | |
// _oo0oo_ | |
// o8888888o | |
// 88" . "88 | |
// (| -_- |) | |
// 0\ = /0 | |
// ___/`---'\___ | |
// .' \\| |// '. | |
// / \\||| : |||// \ | |
// / _||||| -:- |||||- \ |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
doc = Nokogiri::HTML(open('http://learnyousomeerlang.com/content')) | |
urls = [ 'http://learnyousomeerlang.com/content' ] + doc.xpath('//h3/a').map { |n| n.attribute('href').to_s } | |
exec("./wkhtmltopdf -s A4 #{ urls.join(' ') } learnyousomeerlang.pdf") |
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
var fs = require('fs'); | |
var from = new Date().getTime(); | |
var waiting = 0; | |
fs.readFile("test.mp4",function(err, data) { | |
if(err) | |
console.log("read error: ", err); | |
else { | |
for (var i = 1; i <= 10; i++) { | |
waiting ++; | |
fs.writeFile(__dirname + "/new.mp4", data , function(err) { |
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
var fs = require('fs'); | |
var from = new Date().getTime(); | |
for (var i = 1; i <= 10; i++) { | |
fs.readFile("test.mp4",function(err, data) { | |
if(err) | |
console.log("read error: ", err); | |
else { | |
fs.writeFile(__dirname + "/new.mp4", data , function(err) { | |
if(err) { | |
console.log("write error: ", err); |
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
#define CHECKIFSIMULATOR(MSG) { \ | |
if ([[[UIDevice currentDevice] model] rangeOfString:@"Simulator"].location != NSNotFound) { \ | |
UIAlertView *simError = [[UIAlertView alloc] initWithTitle:@"iOS Simulator" \ | |
message:MSG \ | |
delegate:self \ | |
cancelButtonTitle:@"Okay" \ | |
otherButtonTitles:nil]; \ | |
[simError show]; \ | |
[simError release]; \ | |
} \ |
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
// Usage: [self.navigationBar setTintColor: [AppDelegate colorWithHexString:@"4891CC"]]; | |
@interface UIColor (ColorCategory) | |
+(UIColor *) colorWithHexString:(NSString *)hex; | |
@end | |
@implementation UIColor (ColorCategory) |
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
// | |
// NPReachability+Backward.h | |
// | |
// NPReachability+Backward is a category over the NPReachability class. | |
// | |
// It implements some of the Reachability methods and thus makes it easy to integrate with existing projects. | |
// | |
#import <Foundation/Foundation.h> | |
#import "NPReachability.h" |
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
- (NSString *)flattenHTML:(NSString *)html trimWhiteSpace:(BOOL)trim { | |
NSScanner *theScanner; | |
NSString *text = nil; | |
theScanner = [NSScanner scannerWithString:html]; | |
while ([theScanner isAtEnd] == NO) { | |
// find start of tag |
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
// | |
// UIDeviceHardware.h | |
// | |
// Used to determine EXACT version of device software is running on. | |
#import <Foundation/Foundation.h> | |
@interface UIDeviceHardware : NSObject | |
- (NSString *) platform; |
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
@interface NSString (MD5) | |
-(NSString *) MD5; | |
@end | |
@implementation NSString (MD5) | |
- (NSString *) MD5{ | |
const char* string = [self UTF8String]; |
NewerOlder