Skip to content

Instantly share code, notes, and snippets.

vmrun version 1.13.0 build-1331545
Usage: vmrun [AUTHENTICATION-FLAGS] COMMAND [PARAMETERS]
AUTHENTICATION-FLAGS
--------------------
These must appear before the command and any command parameters.
@stevenhuey
stevenhuey / gist:3023781
Created June 30, 2012 13:40
Creating our AVMutableComposition and AVPlayer
// Setup
_composition = [AVMutableComposition composition];
_audioMixValues = [[NSMutableDictionary alloc] initWithCapacity:0];
_audioMixTrackIDs = [[NSMutableDictionary alloc] initWithCapacity:0];
// Insert the audio tracks into our composition
NSArray* tracks = [NSArray arrayWithObjects:@"track1", @"track2", @"track3", @"track4", nil];
NSString* audioFileType = @"wav";
@stevenhuey
stevenhuey / response.json
Created April 4, 2017 20:02
All Airports Response
{
"data": {
"allAirports": [
{
"name": "Sealand Helipad",
"latitude": 51.894444,
"iataCode": "",
"identifier": "ZZ-0001",
"isoCountry": "GB",
"__typename": "Airport",
@stevenhuey
stevenhuey / request.json
Created April 4, 2017 20:01
All Airports Request
{
"query": "query AllAirports { allAirports { __typename airportId identifier airportType name elevation isoCountry isoRegion municipality gpsCode iataCode localCode homepageURL wikipediaURL scheduledService latitude longitude }}"
}
@stevenhuey
stevenhuey / DeleteUnusedEvernoteTags.scpt
Created March 4, 2017 14:49
Find any unused Evernote tags and delete them
tell application "Evernote"
try
set theTags to every tag
repeat with theTag in theTags
set theNotes to {}
set theName to "\"" & name of theTag & "\""
set theNotes to (find notes "tag:" & theName)
if theNotes is {} then
delete tag (name of theTag)
end if
query AllAirports {
allAirports {
airportId,
identifier,
airportType,
name,
elevation,
isoCountry,
isoRegion,
municipality,
@stevenhuey
stevenhuey / NSPersistentContainer.m
Created February 25, 2017 23:05
NSPersistentContainer
self.persistentContainer = [NSPersistentContainer persistentContainerWithName:@"Model"];
[self.persistentContainer loadPersistentStoresWithCompletionHandler:
^(NSPersistentStoreDescription* description, NSError* error) {
NSLog(@"%@ %@", description, error);
}];
- (void)searchFor:(NSString*)query
{
// Cancel any existing search queries
if (self.searchQuery)
{
[self.searchQuery cancel];
self.searchQuery = nil;
[self.searchResults removeAllObjects];
[self updateSearchResults];
}
- (void)indexAirportData
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
for (ALAirport* airport in self.airports)
{
// Create the attribute set
CSSearchableItemAttributeSet* attributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString*)kUTTypeItem];
attributeSet.displayName = airport.airportName;
attributeSet.latitude = @(airport.coordinate.latitude);
@stevenhuey
stevenhuey / config.m
Created September 9, 2013 15:58
Barista Server Config.
- (void)runWithURL:(NSURL*)serverRoot onPort:(NSUInteger)port
{
_server = [BARServer serverWithPort:port];
[_server addGlobalMiddleware:[MarkdownTemplateRenderer rendererWithViewsDirectoryURL:serverRoot]];
BARRouter *router = [[BARRouter alloc] init];
[_server addGlobalMiddleware:router];
[router addRoute:@"/:view" forHTTPMethod:@"GET" handler:^BOOL(BARConnection *connection, BARRequest *request, NSDictionary *parameters)