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
| // | |
| // TestSomethingCoolTests.m | |
| // TestSomethingCoolTests | |
| // | |
| // Created by Paul Wood on 9/14/16. | |
| // Copyright © 2016 Paul Wood. All rights reserved. | |
| // | |
| #import <XCTest/XCTest.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
| //: # TimeZones | |
| import Foundation | |
| let tzs = NSTimeZone.knownTimeZoneNames() | |
| var seperated : [String:Array<String>] = [String:[String]]() | |
| func addToSeperated(_ region : String,_ place:String) -> Void { | |
| if let _ = seperated[region] { | |
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
| /** | |
| Purpose: | |
| Convert (or Serialize) an object to a JSON String or Dictionary. | |
| Usage: | |
| Use 'Serialize.toJSON' on instances of classes that: | |
| - Inherit from NSObject | |
| - Implement 'Serializable' protocol | |
| - Implement the property 'jsonProperties' and return an array of strings with names of all the properties to be serialized | |
| Inspiration/Alternative: | |
| https://gist.github.com/anaimi/ad336b44d718430195f8 |
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
| // | |
| // PersistedObjectResponse.swift | |
| // Hoozin-iOS | |
| // | |
| // Created by Paul Wood on 12/10/15. | |
| // Copyright © 2015 Paul Wood. All rights reserved. | |
| // | |
| import Foundation | |
| import Alamofire |
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
| - (UIImage *) imageByTrimmingTransparentPixels { | |
| //adjust to scale | |
| int rows = self.size.height * self.scale; | |
| int cols = self.size.width * self.scale; | |
| int bytesPerRow = cols*sizeof(uint8_t); | |
| if ( rows < 2 || cols < 2 ) { | |
| return self; | |
| } | |
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) updateProjection{ | |
| CGSize size = [[CCDirector sharedDirector] winSizeInPixels]; | |
| CGSize sizePoint = [[CCDirector sharedDirector] winSize]; | |
| float zeye = [[CCDirector sharedDirector] getZEye]; | |
| kmMat4 matrixPerspective, matrixLookup; | |
| float stringPerspective[16]; |
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)postImage{ | |
| // Get a ADN Token | |
| NSString *access_token = @"foobar"; | |
| NSURL *url = [NSURL URLWithString:@"https://alpha-api.app.net"]; | |
| AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url]; | |
| [httpClient setDefaultHeader:@"Authorization" value:[NSString stringWithFormat:@"Bearer %@", access_token]]; | |
| NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"bird.jpg"], 0.5); | |
| NSMutableURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" | |
| path:@"/stream/0/files" |
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
| var express = require('express'), | |
| path = require('path'), | |
| http = require('http'), | |
| wine = require('./routes/wines'), | |
| cup = require('./routes/cups'), | |
| imagepost = require('./routes/imageposts'); | |
| mongo = require('mongodb'), | |
| Server = mongo.Server, | |
| Db = mongo.Db, | |
| GridStore = mongo.GridStore, |
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
| //If you get an error in the console like this: | |
| /* | |
| TypeError: Cannot convert null to object | |
| at exports.updateImagePost (/Projects/nodecellar_pw/routes/imageposts.js:160:12) | |
| at callbacks (/Projects/nodecellar_pw/node_modules/express/lib/router/index.js:161:37) | |
| at param (/Projects/nodecellar_pw/node_modules/express/lib/router/index.js:135:11) | |
| at param (/Projects/nodecellar_pw/node_modules/express/lib/router/index.js:132:11) | |
| at pass (/Projects/nodecellar_pw/node_modules/express/lib/router/index.js:142:5) | |
| at Router._dispatch (/Projects/nodecellar_pw/node_modules/express/lib/router/index.js:170:5) |
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
| var express = require('express'), | |
| path = require('path'), | |
| http = require('http'), | |
| wine = require('./routes/wines'), | |
| cup = require('./routes/cups'); | |
| var Grid = require('gridfs-stream'); | |
| var mongo = require('mongodb'); | |
| var Server = mongo.Server, | |
| Db = mongo.Db; | |
| var server = new Server('localhost', 27017, {auto_reconnect: true}); |