This file contains 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
// Let's not block while loading data from a file | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
NSString *path = [[NSBundle mainBundle] pathForResource:@"word_list" ofType:@"txt"]; | |
NSError *error; | |
NSString *contents = | |
[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; | |
self.tableData = [contents componentsSeparatedByString:@"\n"]; |
This file contains 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
// Assume all the words in the list are lowercase | |
- (NSArray *)filterListOfWords:(NSArray *)words byFirstLetter:(NSString *)aLetter | |
{ | |
// Use NSPredicate to filter the words in the list | |
NSString *regex = [NSString stringWithFormat:@"^%@.*$", [aLetter lowercaseString]]; | |
NSPredicate *filter = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; | |
NSArray *list = [words filteredArrayUsingPredicate:filter]; | |
This file contains 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
Set fso = CreateObject("Scripting.FileSystemObject") | |
Set theFolder = fso.GetFolder("C:\Windows") | |
Wscript.Echo "Directory:" & vbNewLine & theFolder.Path | |
Set theFiles = theFolder.Files | |
For Each aFile in theFiles | |
' Note: You have to use the File System Object! | |
If UCase(fso.GetExtensionName(aFile.Name)) = "INI" Then |
This file contains 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
/* | |
* Several methods from CoreLocation were deprecated in iOS 7. Some were replaced | |
* by methods in other classes. Here are some very bare notes describing how to | |
* circumscribe a region and then use that region to do geofencing. | |
*/ | |
static NSString *ExeterAppleStoreRegion = @"XYZMyAppExeterAppleStoreRegion"; | |
CLLocationCoordinate2D center = CLLocationCoordinate2DMake(50.72451, -3.52788); | |
CLLocationDistance radius = 30.0; |
This file contains 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
Imports System.Xml | |
Sub TurnOffPOSLoggingInFile(posConfigFilePath As String) | |
Dim doc As New XmlDocument() | |
doc.Load(posConfigFilePath) | |
' We want the "Add" nodes, which are the only child nodes at the end of this path | |
Dim posConfigurationNodes As XmlNodeList = doc.Item("configuration").Item("system.diagnostics").Item("switches").ChildNodes | |
This file contains 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
from rocket import Rocket | |
from bottle import Bottle | |
from bottle import route | |
app = Bottle(__name__) | |
app.debug = True | |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
/* | |
* Assume the following: | |
* | |
* - The Plist file is called: Names.plist | |
* - @property NSArray *tableData | |
* - Callback block messages UITableView with reloadData | |
*/ | |
- (void)initizeDataWithTableViewCallback:(void(^)(void))reloadDataMessage | |
{ |
This file contains 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
/* | |
* Assume the following: | |
* | |
* @property UILocalizedIndexCollation *collation; | |
* @property NSMutableArray *sections; | |
* @property NSArray *tableData; | |
*/ | |
- (void)configureSectionData | |
{ |
OlderNewer