Skip to content

Instantly share code, notes, and snippets.

View aaronpearce's full-sized avatar

Aaron Pearce aaronpearce

View GitHub Profile
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.
-(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];
// 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
[[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];
}];
}
}];
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)
@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'];
// 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];
function addMessage(html) {
var li = document.createElement('li');
var list = document.getElementByID('list');
li.innerHTML= unescape(html);
alert(unescape(html));
list.appendChild(li);
alert('test');
}
As messages are received, update room's last message value to that timestamp. Then call the DB if this timestamp is higher than the current timestamp in that view.
Or...
Use notification center or a instance var to set timestamp of the newest message for the current view if it is a chat view.
Then the chat will compare this to it's last message and load the messages in if needed.
Hi
I found your profile on dribble and I like your work.
My friend and I are starting up an online music streaming service (" a
Spotify for the African vertical) and would love some design help.
We are self funded therefore our budget is quite little. We would like
to have an idea of what your costs are.