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
require 'open-uri' | |
86.times do |sample| | |
begin | |
open("nyb_#{sample}.mp3", 'wb') do |file| | |
file << open("http://www.newyorkbrass.com/samples/samples/nyb_#{sample}.mp3").read | |
puts "nyb_#{sample}.mp3 - saved" | |
end | |
rescue Exception => ex | |
puts "Error: #{ex}" |
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
;; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
;; An Introduction to ClojureScript for Light Table users | |
;; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
;; Basics | |
;; ============================================================================ | |
;; To begin, open the command pane (type Control-SPACE), Add Connection, select | |
;; Light Table UI. Once connected you can evaluate all the forms in this file |
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
dispatch_async(kBgQueue, ^{ | |
NSData* data = [NSData dataWithContentsOfURL: | |
kLatestKivaLoansURL]; | |
[self performSelectorOnMainThread:@selector(fetchedData:) | |
withObject:data waitUntilDone:YES]; | |
}); |
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
[operation setUploadProgressBlock:^(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) { | |
float prog = (totalBytesWritten / (totalBytesExpectedToWrite * 1.0f) * 100); | |
[self.progBar setProgress:prog]; | |
NSLog(@"%f%% Uploaded", (totalBytesWritten / (totalBytesExpectedToWrite * 1.0f) * 100)); | |
}]; |
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
/* | |
===================================================== | |
GetPlayer:Dribbble | |
===================================================== | |
*/ | |
- (void)getPlayer:(NSString*)playername success:(void (^)(NSMutableDictionary *deals))success failure:(void (^)(NSError *error))failure | |
{ | |
NSLog(@"Dribbble test"); | |
NSURL *url = [NSURL URLWithString:@"http://api.dribbble.com/players/"]; | |
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url]; |
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
-(NSString*) encodeString:(NSString *)value { | |
NSString *rawText = value; | |
NSString *encodedText = [rawText stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSLog(@"Encoded text: %@", encodedText); | |
NSString *decodedText = [encodedText stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSLog(@"Original text: %@", decodedText); | |
return encodedText; | |
} |
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
def chunky | |
cap_letters = ('A'..'Z') | |
low_letters = ('a'..'z') | |
nums = (0..9) | |
soup = Array.new | |
result = Array.new | |
cap_letters.each do |part| | |
soup << part |
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
- (UIImage *)fixOrientation { | |
// No-op if the orientation is already correct | |
if (self.imageOrientation == UIImageOrientationUp) return self; | |
// We need to calculate the proper transformation to make the image upright. | |
// We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored. | |
CGAffineTransform transform = CGAffineTransformIdentity; | |
switch (self.imageOrientation) { |
NewerOlder