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
// | |
// NSManagedObject+RFObject.h | |
// PocketID | |
// | |
// Created by Konstantin Koval on 09/01/14. | |
// Copyright (c) 2014 Rocketfarm. All rights reserved. | |
// | |
#import <CoreData/CoreData.h> |
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
#import <Foundation/Foundation.h> | |
NSString* LocalizedStringForLanguage(NSString *countryCode, NSString * string); |
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
// | |
// NSDictionary+Networking.h | |
// PocketID | |
// | |
// Created by Konstantin Koval on 20/01/14. | |
// Copyright (c) 2014 Rocketfarm. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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
// 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 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
+ (void)sf_swapSelector:(SEL)aOriginalSelector withSelector:(SEL)aSwappedSelector | |
{ | |
Method originalMethod = class_getInstanceMethod(self, aOriginalSelector); | |
Method swappedMethod = class_getInstanceMethod(self, aSwappedSelector); | |
SEL newSelector = NSSelectorFromString([NSString stringWithFormat:@"sf_original_%@", NSStringFromSelector(aOriginalSelector)]); | |
class_addMethod([self class], newSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); | |
class_replaceMethod([self class], aOriginalSelector, method_getImplementation(swappedMethod), method_getTypeEncoding(swappedMethod)); | |
} |
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
mogenerator -m -O -M /autogenerated -H --template-var arc=true | |
// Reall example | |
mogenerator -m Model/Model.xcdatamodeld/Model.xcdatamodel -O Model -M Model/autogenerated -H Model --template-var arc=true |
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
package no.rocketfarm.festivalcore.util; | |
import java.io.UnsupportedEncodingException; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
public class StringEncryption { | |
private static String convertToHex(byte[] data) { | |
StringBuilder buf = new StringBuilder(); |
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
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.preference.PreferenceManager; | |
public class PrefUtils { | |
/** | |
* Called to save supplied value in shared preferences against given key. | |
* @param context Context of caller activity |
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
- (<#type#>)<#propertyName#> { | |
return [objc_getAssociatedObject(self, _cmd) <#NSNumberMethod#>]; | |
} | |
- (void)set<#propertyName#>:(<#type#>)object | |
{ | |
objc_setAssociatedObject(self, @selector(<#propertyName#>), [NSNumber numberWith:object], OBJC_ASSOCIATION_); | |
} |
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
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName | |
namespaceURI:(NSString *)namespaceURI | |
qualifiedName:(NSString *)qName | |
attributes:(NSDictionary *)attributeDict | |
{ | |
NSString *ident = [attributeDict objectForKey:@"id"]; | |
KMLStyle *style = [_placemark style] ? [_placemark style] : _style; | |
// Style and sub-elements |
OlderNewer