Skip to content

Instantly share code, notes, and snippets.

View celian-m's full-sized avatar

celian celian-m

  • MyStudioFactory
  • Paris
View GitHub Profile
@celian-m
celian-m / bash_profile
Created February 24, 2016 16:57
MAC OS X Bash Profile basic
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
alias sub='sublime'
alias ll='ls -la'
@celian-m
celian-m / Register.md
Last active January 19, 2016 13:37
Registering for remote notificatiosn

#Register for remote notifications in Objective-C

    if ([application
         respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        
        UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:
        UIUserNotificationTypeAlert | 
        UIUserNotificationTypeBadge | 
 UIUserNotificationTypeSound categories:nil];
@celian-m
celian-m / CMBanner.md
Last active February 24, 2016 17:02
Banner

#Add a top-right banner to your view Added Banner ##Usage

 let banner = CMBannerView(frame: CGRectMake(0, 0, 120, 120), text: "New", color: UIColor.redColor(), width: 30)
 myView.addSubview(banner)

##Implementation

@celian-m
celian-m / Twitter.md
Last active February 28, 2018 13:09
Generate Twitter Bearer Token

Generate a Bearer token to access Twitter REST API

- (void) generateAPIKeyWithCompletionBlock:(void (^)(BOOL success, NSString* twitterOAuthToken, NSString *error))completion {
    //Network tasks should be in background thread
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
        
        //Generate Bearer Token according to Twitter Documentation
        NSString* bearerToken = [NSString stringWithFormat:@"%@:%@", TWITTER_API_KEY , TWITTER_API_SECRET];
        bearerToken = [[bearerToken dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0];
@celian-m
celian-m / Singleton.md
Last active January 19, 2016 13:57
iOS Singleton

Generate Objective-C Singleton

@implementation <#MyManager#>

#pragma mark Singleton Methods

+ (id)sharedManager {
    static <#MyManager#> *sharedManager = nil;
    static dispatch_once_t onceToken;
 dispatch_once(&amp;onceToken, ^{