Skip to content

Instantly share code, notes, and snippets.

Avatar

Craig Marvelley craigmarvelley

View GitHub Profile
View artists.json
[{"id":1,"name":"3 Hwr Doeth","description":"A mysterious hip hop crew from the Caernarfon area, big on lo-fi beats, weird pseudonyms and swearing, 3 Hwr Doeth bring the weirdness and Welsh language rap grubbiness in the best way since cult icons Tystion. Their debut, self-titled album, released on the great Pasta Hull label, is a rowdy 16-tracker, taking in much guest appearances and dissolute living, and which, in Smocio, Hustlo, Dwyn O Tesco, contains both epic title and life motto, whatever lingo you speak.","description_cy":"Hip hop collective o Gaernarfon yw 3 Hwr Doeth, yn arbrofi gyda synau gwahanol ag yn uno eu dylanwadau eclectig i greu rap Cymraeg sy\u2019n ymgorffori elfennau o funk, jazz a blues.","facebook":"https:\/\/www.facebook.com\/3hwrdoeth\/","soundcloud":"https:\/\/soundcloud.com\/3-hwr-doeth","twitter":"https:\/\/twitter.com\/achwmet","website":null,"image_url":"http:\/\/swnfest.com\/wp-content\/uploads\/2019\/04\/3-HWR-DOETH-2.jpg"},{"id":2,"name":"Alffa","description":"In these mid-apo
View venues.json
[{"id":1,"name":"Jacob's (Off Track Cafe)","address":"W Canal Wharf","city":"Cardiff","postcode":"CF10 5DB","telephone_number":"029 2039 0939","website":"https:\/\/jacobsmarket.co.uk","latitude":51.47546,"longitude":-3.17614,"capacity_status":0},{"id":2,"name":"Jacob's 2","address":"W Canal Wharf","city":"Cardiff","postcode":"CF10 5DB","telephone_number":"029 2039 0939","website":"https:\/\/jacobsmarket.co.uk","latitude":51.47546,"longitude":-3.17614,"capacity_status":0},{"id":3,"name":"Clwb Ifor Bach (Top)","address":"11 Womanby St","city":"Cardiff","postcode":"CF10 1BR","telephone_number":"029 2023 2199","website":"https:\/\/clwb.net","latitude":51.53443,"longitude":-3.21426,"capacity_status":0},{"id":4,"name":"Clwb Ifor Bach (Lawr)","address":"11 Womanby St","city":"Cardiff","postcode":"CF10 1BR","telephone_number":"029 2023 2199","website":"https:\/\/clwb.net","latitude":51.53443,"longitude":-3.21426,"capacity_status":0},{"id":5,"name":"Kongs","address":"114-116 St Mary Street","city":"Cardiff","postcode"
View events.json
[{"artist_id":21,"venue_id":11,"id":1,"title":null,"start_time":"2019-10-18T19:30:00+0100","finish_time":"2019-10-18T20:15:00+0100","stage":null},{"artist_id":92,"venue_id":11,"id":2,"title":null,"start_time":"2019-10-18T20:45:00+0100","finish_time":"2019-10-18T21:30:00+0100","stage":null},{"artist_id":55,"venue_id":11,"id":3,"title":null,"start_time":"2019-10-18T22:00:00+0100","finish_time":"2019-10-18T23:15:00+0100","stage":null},{"artist_id":78,"venue_id":3,"id":4,"title":null,"start_time":"2019-10-18T19:00:00+0100","finish_time":"2019-10-18T19:30:00+0100","stage":null},{"artist_id":30,"venue_id":3,"id":5,"title":null,"start_time":"2019-10-18T20:00:00+0100","finish_time":"2019-10-18T20:30:00+0100","stage":null},{"artist_id":72,"venue_id":3,"id":6,"title":null,"start_time":"2019-10-18T21:00:00+0100","finish_time":"2019-10-18T21:30:00+0100","stage":null},{"artist_id":73,"venue_id":3,"id":7,"title":null,"start_time":"2019-10-18T22:00:00+0100","finish_time":"2019-10-18T22:45:00+0100","stage":null},{"artist_id"
View NSObject+RateLimiting.m
- (NSMutableDictionary *)throttleActionHash
{
NSMutableDictionary *throttleData = objc_getAssociatedObject(self, THROTTLE_ACTION_HASH_PROPERTY_KEY);
if (!throttleData) {
throttleData = [[NSMutableDictionary alloc] init];
objc_setAssociatedObject(self, THROTTLE_ACTION_HASH_PROPERTY_KEY, throttleData, OBJC_ASSOCIATION_RETAIN);
}
return throttleData;
View migration1.m
// Assume we have an NSPersistentStoreCoordinator which has been initialised with our entity model, and
// an NSURL which points to our store's location on disk
NSDictionary *sourceMetadata = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:NSSQLiteStoreType URL:storeUrl options:options error:&error];
NSManagedObjectModel *destinationModel = coordinator.managedObjectModel;
BOOL storeIsCompatible = [destinationModel isConfiguration:nil compatibleWithStoreMetadata:sourceMetadata];
@craigmarvelley
craigmarvelley / progress.m
Last active Apr 26, 2017
NSProgress/UIProgressView example
View progress.m
// Create a progress bar view
UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
progressView.progress = 0;
// Assume we have a progress object
NSProgress *progress = [self progressForOngoingTask];
// Observe the 'fractionCompleted' property and update the progress view as it changes
[self.KVOController observe:progress keyPath:@"fractionCompleted" options:NSKeyValueObservingOptionNew block:^(id _Nullable observer, id _Nonnull object, NSDictionary<NSString *, id> *_Nonnull change) {
dispatch_async(dispatch_get_main_queue(), ^{
View UIActivityControllerExample.m
NSURL *pathToPdfFile;
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:@[ result ] applicationActivities:nil];
NSMutableArray *excludedActivities = [NSMutableArray array];
NSNumber *emailOutEnabled = [self.userPreferences.featureFlags valueForKeyPath:@"research.share.email"];
if (!emailOutEnabled.boolValue) {
[excludedActivities addObject:UIActivityTypeMail];
}
View prepare-for-segue-inject.m
- (void)interceptSeguesToPerformDependencyInjection {
NSError *error;
id<AspectToken> DIAspectToken = [UIViewController aspect_hookSelector:@selector(prepareForSegue:sender:) withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> aspectInfo, UIStoryboardSegue *segue, id sender) {
UIViewController *destinationController = segue.destinationViewController;
[self.UIAssembly inject:destinationController];
View typhoon-example-3.m
- (void)showNoteSplitViewWithDataController:(DataController *)dataController searchController:(SearchController *)searchController {
NSParameterAssert(dataController);
NSParameterAssert(searchController);
NSString *authenticatedUserId = self.applicationSessionCredentialStore.userId;
NoteSplitViewAssembly *assembly = [self.assembly noteSplitViewAssemblyWithApplicationSession:self.applicationSession dataController:dataController searchController:searchController authenticatedUserId:authenticatedUserId];
[assembly activate];
View typhoon-example-2.m
@interface CoordinatorAssembly
@property (strong, nonatomic) DependencyOne *existingInjectedDependency;
- (DependencyTwo *)newDependency;
- (MyModel *)modelThatIsInjectedWithBothDependencies;
@end
You can’t perform that action at this time.