Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block quantumpotato

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gamepad
loopGamepadInput() {
var pads = navigator.getGamepads();
if (pads) {
for (var i = 0; i < pads.length; i++) {
var gp = pads[i];
if (!gp) {
var x = gp.axes[0];
View Turbo
class TurboMover extends Component {
registrationNames() {
return ['velocity'];
getValue(name, hash) {
if (name == 'velocity') {
hash.vx = hash.vx * 20; //times speed
hash.vy = hash.vy * 20;
View gist:19788003148b47ea423d
loop() { =;
var delta = - this.last;
this.last =;
this.dt = this.dt + delta;
if (this.dt < this.rate) {
View gist:49bb52da8eea3ff3e0c6
stage = 1
def show_prompt():
if stage == 1:
print "You are between a volcano and a supernova."
print "1 for volcano, 2 for supernova."
def restart_input():
print "Nice try."
View gist:4736250
[self.button1 setImage:[UIImage imageNamed:@"image_up.png"] forState:UIControlStateNormal];
[self.button1 setImage:[UIImage imageNamed:@"image_down.png"] forState:UIControlStateSelected];
quantumpotato / gist:3709551
Created Sep 12, 2012
Avoiding multiple #import .h when using @Class forward declaration
View gist:3709551
#import "ClonePilotBattlefield.h"
#import "QPBFState.h"
#import "QPBFTitleState.h"
#import "QPBFDrawingState.h"
#import "QPBFInputConstants.h"
@interface QPBattlefield : ClonePilotBattlefield
quantumpotato / BlockHacking
Created Feb 17, 2012
For X in Y with C do {}
View BlockHacking
#import "BlockHacking.h"
typedef void (^twoObjectBlock)(id a, id b);
typedef void (^XYZBlock)(Class x, NSArray *y, id c, twoObjectBlock b);
XYZBlock arrayDoBlock = ^(Class x, NSArray *y, id c, twoObjectBlock b) {
for (x in y) {
quantumpotato / NSNotificationCenter+CHAdditions
Created Jan 3, 2012
NSNotification observing with blocks
View NSNotificationCenter+CHAdditions
#import <Foundation/Foundation.h>
@interface NSNotificationCenter (CHAdditions)
+ (void)addObserver:(id)observer forNotificationNamed:(NSString *)notificationName withBlock:(void (^)(NSNotification *note))block;
#import "NSNotificationCenter+CHAdditions.h"
quantumpotato / StreamHandler.js
Created Sep 6, 2011
Adding, sending and writing messages from a queue on a player(client).
View StreamHandler.js
//We store chat messages for the player until they send us their input
//Otherwise the message will get sent and terminal writes it *next to* whatever they are typing!
function StreamHandler() {
this.addMessage = function(player, message) {
this.writeMessage = function(player, cb) {
if (player.messages.length > 0) {
You can’t perform that action at this time.