Skip to content

Instantly share code, notes, and snippets.

View aaronpearce's full-sized avatar

Aaron Pearce aaronpearce

View GitHub Profile
for (int i = 0; i < [[self tablumps] count]; i++) {
bodyString = [bodyString stringByReplacingOccurrencesOfString:[[self tablumps] objectAtIndex:i] withString:[[self tablumpsReplace] objectAtIndex:i]];
}
for (int j = 0; j < [[self tablumpsRegex] count]; j++) {
bodyString = [bodyString stringByReplacingOccurrencesOfRegex:[[self tablumpsRegex] objectAtIndex:j] withString:[[self tablumpsRegexReplace] objectAtIndex:j]];
bodyString = [bodyString stringByReplacingOccurrencesOfString:@":f" withString:@"/f"];
bodyString = [bodyString stringByReplacingOccurrencesOfString:@":i" withString:@"/i"];
[{"chatname":"damnmobile","description":"The official room for dAmnMobile, the only iOS app to get on dAmn!"},{"chatname":"damnmobile","description":"The official room for dAmnMobile, the only iOS app to get on dAmn!"}]a
-(NSString *)avatarCreate:(NSString *)username:(int)num {
NSArray *extensions = [NSArray arrayWithObjects:@".gif", @".gif", @".jpg", @".png", nil];
int x = 3;
int y = 2;
int z = 15;
int cachebust = (num >> y) & z;
int tnum = num & x;
NSString *extension = [extensions objectAtIndex:tnum];
0) #TheToyStore
1) #DrakenguardAcademy
2) #ToyStoreOOC
3) #WriteRoom
4) #DynastyOfHeroesRP
5) #InuyashaYYHRP
6) #lolwat
7) #NarutoWorldRP
8) #Ravemachine
9) #ShadowForestWolfPack
-(NSDictionary *)parser:(NSString *)packet:(NSInteger)depth {
NSMutableArray *partsArr = [NSMutableArray arrayWithArray:[packet componentsSeparatedByString:@"\n\n"]]; // Split by \n\n
NSMutableArray *headArr = [NSMutableArray arrayWithArray:[[partsArr objectAtIndex:0] componentsSeparatedByString:@"\n"]]; // Split by \n
[partsArr removeObjectAtIndex:0];
NSMutableArray *cmdArr = [NSMutableArray arrayWithArray:[[headArr objectAtIndex:0] componentsSeparatedByString:@" "]];
[headArr removeObjectAtIndex:0];
NSString *cmd = [cmdArr objectAtIndex:0];
dAmnMobile Sunya
================
- SQLite Message Store
- UIWebView for Message View
- UITableView for Chat List, User List
- Store timestamps to show number of unread messages
- Show user's info on tap
- Allow viewing of deviations by interlinking with dA Mobile
- Backgrounding of the application
@aaronpearce
aaronpearce / PHP Token Grabber
Created June 6, 2011 05:36
dAmntoken grabber using PHP
<?php
// Set vars
$os = PHP_OS;
$cid= 21;
$csecret= "dba44bb59a5b303dd3d66a13e3cd4665";
// OS Check for browser opening
if($os == "Darwin") {
exec("open 'https://www.deviantart.com/oauth2/draft15/authorize?client_id=".$cid."&redirect_uri=http://damnapp.com/apicode.php&response_type=code'");
} elseif($os == "WINNT") {
@aaronpearce
aaronpearce / gist:1009619
Created June 6, 2011 01:28
oAuth2 deviantART Commandline idea
First you give the user the auth url (could open it automatically using open, start or browser) eg:
Client_id = your client id.
https://www.deviantart.com/oauth2/draft15/authorize?client_id=**&redirect_uri=http://aaronpearce.com&response_type=code
This will ask to auth (they will need to be logged in to the correct account) then it will redirect to that site.
That code is used to grab your access token. A specialized site will be put up to allow users to read this easier. (dA might put one up, I asked)
Then you will curl to the token is this:
Hey,
Thanks for taking the time to discuss this with me.
The developers of the community are interested in running a featured chat with some of dA's developers to ask questions about the API, dA technologies and more general stuff.
Having a featured chat with the developers behind dA would help the third party developers based around dA to make some more awesome extensions and scripts while also allowing us to discuss some of the issues we see with small stuff on dA.
The other issue is how we see chats running in #auditorium go. The issue is that anyone can ask which normally results in the good questions not being asked, we'd prefer a way to get our questions to the developers first then let others ask if possible?
@aaronpearce
aaronpearce / gist:1005766
Created June 3, 2011 02:38
Auth grab Obj-C
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"https://www.deviantart.com/api/draft15/user/damntoken"]];
[request addRequestHeader:@"Authorization" value:[NSString stringWithFormat:@"OAuth %@", [auth accessToken]]];
NSLog(@"%@", auth );
[request startSynchronous];
NSError *error = [request error];
if (!error) {
NSString *response = [request responseString];
NSLog(@"%@", response);
} else {