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)login{ | |
NSURL *baseURL = [NSURL URLWithString:@"https://api.usergrid.com/[org]/[app]"]; | |
AFHTTPClient* client = [[AFHTTPClient alloc] initWithBaseURL:baseURL]; | |
[client setDefaultHeader:@"Accept" value:RKMIMETypeJSON]; | |
[client registerHTTPOperationClass:[AFJSONRequestOperation class]]; | |
NSDictionary *params = [[NSDictionary alloc] initWithObjectsAndKeys: | |
@"password",@"grant_type", | |
@"john.doe",@"username", | |
@"password",@"password", | |
nil]; |
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
#!/bin/bash | |
# <UDF name="ssh_key" Label="Paste in your public SSH key" default="" example="" optional="false" /> | |
# root ssh keys | |
mkdir /root/.ssh | |
echo $SSH_KEY >> /root/.ssh/authorized_keys | |
chmod 0700 /root/.ssh | |
# update to latest |
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 http = require('http'); | |
var assert = require('assert'); | |
var gridform = require('gridform'); | |
var formidable = require('formidable'); | |
var mongo = require('mongo') | |
, database = mongo.connect('mydb') | |
, collection = database.collection('fs'); | |
// assuming you've already created a db instance and opened it | |
gridform.db = database; |
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}); |
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'), | |
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
- (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
-(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
- (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
// | |
// PersistedObjectResponse.swift | |
// Hoozin-iOS | |
// | |
// Created by Paul Wood on 12/10/15. | |
// Copyright © 2015 Paul Wood. All rights reserved. | |
// | |
import Foundation | |
import Alamofire |
OlderNewer