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
@interface EncryptionTransformer : NSValueTransformer | |
{} | |
/** | |
* Returns the key used for encrypting / decrypting values during transformation. | |
*/ | |
- (NSString*)key; | |
@end |
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
@interface StringEncryptionTransformer : EncryptionTransformer | |
{} |
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
- (id)transformedValue:(NSData*)data | |
{ | |
... | |
// Use another NSData category method (left as an exercise | |
// to the reader) to randomly generate the IV data | |
NSData* iv = [NSData randomDataOfLength:32]; | |
data = [data dataAES256EncryptedWithKey:[self key] Iv:iv]; |
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
#pragma mark - State preservation | |
- (void)encodeRestorableStateWithCoder:(NSCoder*)coder | |
{ | |
[super encodeRestorableStateWithCoder:coder]; | |
// Preserve the managed objects | |
NSData* data = | |
[AManagedObjectArchiver ArchiveDataFromBlock:^(AManagedObjectArchiver* archiver) | |
{ |
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
@interface ACodableManagedObject : NSObject <NSCoding> | |
@property (nonatomic, strong) NSURL* url; | |
+ (id)ObjectWithManagedObject:(NSManagedObject*)obj; | |
@end | |
@implementation ACodableManagedObject | |
+ (id)ObjectWithManagedObject:(NSManagedObject*)obj | |
{ |
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
# -*- mode: ruby -*- | |
# Vagrant file for the lolcats website | |
Vagrant.configure("2") do |config| | |
config.vm.hostname = "lolcats" | |
# Every Vagrant virtual environment requires a box to build off of. | |
config.vm.box = "precise64" | |
# The url from where the 'config.vm.box' box will be fetched if it |
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
SharedExamplesBegin(OrderedCollectionBehavior) | |
// A set of shared test cases are defined here under the key name | |
// "an ordered collection". | |
// | |
// The dictionary param is the only means of providing data from | |
// the shared examples caller to the set of shared examples. | |
// In this case pass in the collection class to be tested. | |
sharedExamplesFor(@"an ordered collection", ^(NSDictionary* data) | |
{ |
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
// child_process is used to spawn the scss-lint binary | |
var child_process = require('child_process'); | |
// map-stream is used to create a stream that runs an async function | |
var map = require('map-stream'); | |
// gulp-util is used to created well-formed plugin errors | |
var gutil = require('gulp-util'); | |
// The main function for the plugin – what the user calls – should return | |
// a stream. | |
var scssLintPlugin = function() { |
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
var gulp = require('gulp'); | |
var path = require('path'); | |
var karma = require('karma').server; | |
/** | |
* Run the Karma server once with the given config file path. | |
*/ | |
function runKarma(configFile, cb) { | |
karma.start({ | |
configFile: path.resolve(configFile), |
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
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var jshint = require('gulp-jshint'); | |
// Command line option: | |
// --fatal=[warning|error|off] | |
var fatalLevel = require('yargs').argv.fatal; | |
var ERROR_LEVELS = ['error', 'warning']; |
OlderNewer