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 *string = @"Hannah"; | |
NSMutableString *reversedStr; | |
int len = [string length]; | |
reversedStr = [NSMutableString stringWithCapacity:len]; | |
while (len > 0) | |
[reversedStr appendString:[NSString stringWithFormat:@"%C", [string characterAtIndex:--len]]]; | |
if([[string lowercaseString] isEqualToString:[reversedStr lowercaseString]]) { | |
NSLog(@"Plaindrome"); | |
} else { |
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(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{ | |
// Do a taks in the background | |
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; | |
[[storage cookies] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
[storage deleteCookie:obj]; | |
if(stop) { | |
NSArray *cookies = [NSKeyedUnarchiver unarchiveObjectWithData:[[self.array objectAtIndex:indexPath.row] objectAtIndex:1]]; | |
[cookies enumerateObjectsUsingBlock:^(id obj2, NSUInteger idx, BOOL *stop2) { | |
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:obj2]; | |
if(stop2) { |
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
<?php | |
/* | |
* Released under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License, which allows you to copy, distribute, transmit, alter, transform, | |
* and build upon this work but not use it for commercial purposes, providing that you attribute me, photofroggy ([email protected]) for its creation. | |
* | |
* | |
* Here we have an example of a Contra extension! | |
* Every extension is a class, and the class has to be | |
* an extension of the extension class, or it won't work |
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
<?php | |
/* | |
* Released by Aaron Pearce (Pickley). All rights reserved. You may use this as you wish, just make sure to mention me. | |
*/ | |
class Random extends extension { | |
public $name = 'Random'; // name - This is the name of the extension! |
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
CookieSyncManager.createInstance(getApplicationContext()); | |
CookieManager mgr = CookieManager.getInstance(); | |
List<Cookie> cookies = ((AbstractHttpClient) httpClient).getCookieStore().getCookies(); | |
if(cookies != null) | |
{ | |
for(Cookie cookie : cookies) | |
{ | |
String cookieString = cookie.getName() + "=" + cookie.getValue() + "; domain=" + cookie.getDomain(); | |
mgr.setCookie(cookie.getDomain(), cookieString); |
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
<?php | |
/* | |
Quick Script for testing bot | |
GPIO Pin Layout | |
17 = Right Motor Forwards | |
18 = Right Motor Backwards | |
22 = Left Motor Forwards |
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
<?php | |
class GPIO { | |
// Using BCM pin numbers. | |
private $pins = ['0', '1', '4', '7', '8', '9', '10', '11', '14', '15', '17', '18', '21', '22', '23', '24', '25']; | |
// exported pins for when we unexport all | |
private $exportedPins = array(); | |
// Setup pin, takes pin number and direction (in or out) |
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
self.tableView.backgroundView = nil; | |
self.tableView.backgroundColor = [UIColor colorWithRed:0.961 green:0.961 blue:0.961 alpha:1.000]; |
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
presetning this onto a normla view controller. Comes as a pagesheet everytime I think | |
NSString *storyboardName = @"MainStoryboard_iPhone"; | |
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) storyboardName = @"MainStoryboard_iPad"; | |
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:storyboardName bundle:nil]; | |
UINavigationController *walkThrough = [storyBoard instantiateViewControllerWithIdentifier:@"walkthroughNav"]; | |
walkThrough.modalPresentationStyle = UIModalPresentationFormSheet; | |
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
+(void)runCommand:(NSString *)command withParameters:(NSDictionary *)params { | |
// create class name | |
command = [[command componentsSeparatedByString:@" "] objectAtIndex:0]; | |
command = [NSString stringWithFormat:@"SYEvent_%@", [command capitalizedString]]; // capitalize | |
Class class = NSClassFromString(command); | |
if([class respondsToSelector:@selector(run:)]) | |
[class performSelector:@selector(run:) withObject:params]; | |
} | |
// checks if class exists for command |