Skip to content

Instantly share code, notes, and snippets.

View hartbit's full-sized avatar
👨‍💻
Swifting, one commit at a time

David Hart hartbit

👨‍💻
Swifting, one commit at a time
  • Atipik Sàrl & Witty Wings SA
  • Geneva, Switzerland
View GitHub Profile
info: Welcome to Nodejitsu trahdivad
info: It worked if it ends with Nodejitsu ok
info: Executing command start
info: Starting app genesis
error: Error running command start
error: Nodejitsu Error (500): Internal Server Error
error: There was an error while attempting to deploy your application.
error:
error: NPM Install failed
error: NPM failed to install dependencies
11
11
11
11
11
11
11
11
11
11
exports.authenticator = (req, res, next) ->
playerId = req?.query?.playerId
if playerId? then return next error(400, 'player id required')
req.playerId = playerId
next()
mongoose = require 'mongoose'
Schema = mongoose.Schema
playerSchema = new Schema
gameCenterID: { type: String, required: true, unique: true }
module.exports = mongoose.model 'Player', playerSchema
mocha = require 'mocha'
should = require 'should'
database = require '../database'
Player = require '../app/player'
describe 'Player', =>
before =>
database.connect()
beforeEach =>
@player = new Player
@hartbit
hartbit / gist:2851614
Created June 1, 2012 12:02
KVC Compliance
@interface FUReadonlyVector2 : NSObject
@property (nonatomic, readonly) GLKVector2 vectorValue;
@end
@implementation FUReadonlyVector2
@synthesize vectorValue = _vectorValue;
@end
@hartbit
hartbit / gist:2595084
Created May 4, 2012 14:22
Trying to install MacRuby
Davids-iMac:~ david$ rvm install macruby-nightly
Retrieving the latest nightly macruby build...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21.4M 100 21.4M 0 0 626k 0 0:00:35 0:00:35 --:--:-- 662k
Password:
Davids-iMac:~ david$ rvm list
rvm rubies
@hartbit
hartbit / gist:2480576
Created April 24, 2012 15:24
Projection Setup
- (void)updateProjection
{
CGSize viewSize = [[[self director] view] bounds].size;
GLKMatrix4 projectionMatrix = GLKMatrix4MakeOrtho(0, viewSize.width, viewSize.height, 0, 0, FLT_MAX);
GLKBaseEffect* effect = [self effect];
[[effect transform] setProjectionMatrix:projectionMatrix];
[effect prepareToDraw];
}
@hartbit
hartbit / gist:2480575
Created April 24, 2012 15:23
VAO Drawing
- (void)drawSpritesWithEffect:(GLKBaseEffect*)effect
{
glBindVertexArrayOES([self vertexArray]);
GLKEffectPropertyTexture* textureProperty = [effect texture2d0];
for (FUSpriteBatch* batch in [[self spriteBatches] allValues])
{
FUTexture* texture = [batch texture];
@hartbit
hartbit / gist:2480571
Created April 24, 2012 15:22
Vertex Buffer Fill
- (void)fillVertexBuffer
{
static const GLKVector2 kT0 = { 0, 0 };
static const GLKVector2 kT1 = { 0, 1 };
static const GLKVector2 kT2 = { 1, 0 };
static const GLKVector2 kT3 = { 1, 1 };
glBindBuffer(GL_ARRAY_BUFFER, [self vertexBuffer]);
FUVertex* vertices = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
NSUInteger vertexIndex = 0;