Based on this gist
For NSDictionary:
@implementation NSDictionary (MutableDeepCopy)
// As seen here (in the comments): https://gist.github.com/yfujiki/1664847
- (NSMutableDictionary *)mutableDeepCopy
{
| var db = require('nano'); | |
| var debug = require('debug')('cleanDb'); | |
| var async = require('async'); | |
| function cleanDb(callback) { | |
| debug('Cleaning up db from all non-design documents'); | |
| db.list(function(err, body) { | |
| if(err) { |
Based on this gist
For NSDictionary:
@implementation NSDictionary (MutableDeepCopy)
// As seen here (in the comments): https://gist.github.com/yfujiki/1664847
- (NSMutableDictionary *)mutableDeepCopy
{
| // Originally found at http://pastebin.com/kdUHWMZf | |
| // Fixed the recursion not working on layers of subviews. | |
| @interface UIView (LayerEdgeAntialiasing) | |
| /** Uses the -setAllowsEdgeAntialiasing: method from CALayer prior to iOS 7, and also can applies it to every sublayers (and sublayers's of sublayers', and so on) if you want to. */ | |
| @property (nonatomic, assign) BOOL allowsLayerEdgeAntialiasing; | |
| - (void)setAllowsLayerEdgeAntialiasing:(BOOL)allowsLayerEdgeAntialiasing applyToSublayers:(BOOL)applyToSublayers; | |
| @end |
| RESOURCES_TESTS_PATH = '<whatever works for you>' | |
| pathToTestJson = (filename) -> | |
| return path.join __dirname, RESOURCES_TESTS_PATH, filename | |
| nockActionIsRecording = () -> | |
| return not _.isUndefined process.env.NOCK_RECORDING and process.env.NOCK_RECORDING == '1' | |
| # If we are recording (NOCK_ACTION == 'recording') then we start the recording and return the filename | |
| # to which we will be saving them. |
| // All these functions are literally based on connect.vhost which borders on unintelligible. I'll fix that when converting to module. | |
| exports.vroute = function(route, server) { | |
| if (!route) throw new Error('vroute route required'); | |
| if (!server) throw new Error('vroute server required'); | |
| var regexpString = '^\\/' + cleanForRegexp(route) + '(\\/.*)$'; | |
| var regexp = new RegExp(regexpString, 'i'); | |
| return function(req, res, next) { | |
| if(!req || !req.url) return next(); | |
| var matches = req.url.match(regexp); |
| -- Finds the index of the device token or -1 if the token doesn't exist in the devices. | |
| function findDeviceIndexForToken(devices, deviceToken) | |
| for i,v in ipairs(devices) do | |
| if v.token == deviceToken then | |
| return i | |
| end | |
| end | |
| return -1 |