Skip to content

Instantly share code, notes, and snippets.

View aaronpearce's full-sized avatar

Aaron Pearce aaronpearce

View GitHub Profile
// avatar maker
-(NSString *)avatarCreate:(NSString *)userName:(int)num {
NSArray *extensions = [NSArray arrayWithObjects:@".gif", @".gif", @".jpg", @".png", nil];
int x = 3;
// fuck this shit :iconfuckthisshitplz:
int tnum = num & x;
NSString *extension = [extensions objectAtIndex:tnum];
[extension retain];
@aaronpearce
aaronpearce / gist:1133023
Created August 8, 2011 23:20
PHP Gallery/UserID Grabber
<?php
if(isset($_GET['username'])) {
$username = $_GET['username'];
$userpage = file_get_contents("http://" . $username . ".deviantart.com");
$first = explode("gruserid=", $userpage);
$parts = explode(">",$first[1]);
$id = $parts[0];
} elseif(isset($_GET['id'])) {
$id = $_GET['id'];
Cisco ASR1002 router doing BGP with two upstreams
going into two Crescendo AppBeat load balancers that do layer 7 load balancing
mix of HP and Cisco switches internally
86 web servers with 2000 GHz of CPU
70 database servers, almost all with Intel X25-E SSDs
60 or so file servers with 1.6 petabytes of space
5 gigabits per second of throughput
350 servers in total
database servers handle 52,000 queries per second
350 current servers.... the year 2000 (founding year) equivalent of what... like... 5000 pIII 1ghz boxes like the ones we started with? (escher, davinci, dali, picasso)
[[result valueForKey:@"response"] enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL *stop) {
if([[[[object valueForKey:@"content"] valueForKey:@"result"] valueForKey:@"count"] objectAtIndex:0] != 0) {
[[[[object valueForKey:@"content"] valueForKey:@"result"] valueForKey:@"hits"] enumerateObjectsUsingBlock:^(id hit, NSUInteger idx, BOOL *stop) {
APAppDelegate *appDele = (APAppDelegate *)[[UIApplication sharedApplication] delegate];
APMasterViewController *amvc = [appDele.navigationController topViewController];
[amvc.dataSet addObject:hit]; // data set = nsmutablearray
[amvc.tableView reloadData];
}];
}
}];
// Sets to allow into the block
__block APAppDelegate *appDele = (APAppDelegate *)[[UIApplication sharedApplication] delegate];
__block APMasterViewController *amvc = [appDele.navigationController topViewController];
id result = [appDele DiFiRequestWithURL:url];
// Runs a loop on the result looping through the responses
[[result valueForKey:@"response"] enumerateObjectsUsingBlock:^(id response, NSUInteger idx, BOOL *stop) {
// Checks if count is not 0?
if([[response valueForKeyPath:@"content.result.count"] objectAtIndex:0] != 0) {
// Loops through the hits from the query
-(void)getDeviationsFromFolder:(int)folderID fromStart:(int)start ToOffset:(int)offset {
// Casting int to string
NSString *theFolderID = [NSString stringWithFormat:@"%d", folderID];
NSString *theStart = [NSString stringWithFormat:@"%d", start];
NSString *theOffset = [NSString stringWithFormat:@"%d", offset];
NSString *theURL = deviationWatch;
// Swapping out ints to string
theURL = [[[theURL stringByReplacingOccurrencesOfString:@"folderid" withString:theFolderID] stringByReplacingOccurrencesOfString:@"start" withString:theStart] stringByReplacingOccurrencesOfString:@"offset" withString:theOffset];
dA Messages brings your deviantART Message Center with you everywhere. Sleek and fast, you can view your friend's deviations, comments and even reply to them!
Have you got a lot of folders or groups? dA Messages handles them with ease, switching between them with just a simple slide and tap. dA Messages will even grab your latest messages and notify you within ten minutes being closed.
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"auto-fetch", [NSNumber numberWithBool:YES], "alert", [NSNumber numberWithInt:48], @"offset", nil];
[userDefaults registerDefaults:dict];
2012-02-03 17:50:25.623 HotdAmn[8758:e03] recv_msg
2012-02-03 17:50:25.624 HotdAmn[8758:e03] *** -[NSArray initWithArray:range:copyItems:]: array argument is not an NSArray
2012-02-03 17:50:25.627 HotdAmn[8758:e03] (
0 CoreFoundation 0x00007fff837e3fc6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff85721d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8378f844 -[NSArray initWithArray:range:copyItems:] + 196
3 CoreFoundation 0x00007fff837bb036 +[NSArray arrayWithArray:] + 70
4 HotdAmn 0x000000010002f7bc -[UserMessage initWithContent:user:] + 284
5 HotdAmn 0x000000010000e0c3 -[EventHandler onRecvMsg:] + 291
6 CoreFoundation 0x00007fff837d375d -[NSObject performSelector:withObject:] + 61
String str = "hannah";
StringBuffer sb = new StringBuffer(str).reverse();
String strRev = sb.toString();
if(str.equalsIgnoreCase(strRev))
System.out.println("Palindrome");
else
System.out.println("Not a Palindrome");