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
<?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
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 | |
/* | |
* 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
<?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
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
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
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"); |
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
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 |
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
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]; |