Skip to content

Instantly share code, notes, and snippets.

@phoboslab
phoboslab / gist:10671262
Created April 14, 2014 18:21
ejecta color hash generator
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
typedef union {
unsigned int hex;
struct {
unsigned char r, g, b, a;
// idbsimple - tiny wrapper around indexeDB to behave like an
// asynchronous localStorage.
// API (all callbacks are optional):
// idbsimple.getItem(key, function(error, value){...});
// idbsimple.setItem(key, value, function(error){...});
// idbsimple.removeItem(key, function(error){...});
// idbsimple.clear(function(error){...});
// idbsimple.delete();
ig.module(
'game.entities.door'
)
.requires(
'plugins.twopointfive.entity'
)
.defines(function(){
EntityDoor = tpf.Entity.extend({
type: ig.Entity.TYPE.NONE,
@phoboslab
phoboslab / gist:5249534
Last active December 15, 2015 10:59
Ejecta Video
var video = document.createElement('video');
console.log( 'can play mp4', video.canPlayType('video/mp4') );
video.src = 'test.mov';
// Also loads from the internet:
//video.src = 'http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT1211/sample_iTunes.mov';
// Show playback controls:
//video.controls = true;
@phoboslab
phoboslab / gist:5967844
Created July 10, 2013 16:32
Get Wifi or Public IP on the iPhone. Works with iOS7
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <net/if.h>
void ip_for_interface(const char *interface_name, char *ip, const int length) {
*ip = NULL;
@phoboslab
phoboslab / gist:3824284
Created October 3, 2012 00:57
Touch Button New
ig.module(
'plugins.touch-button'
)
.requires(
'impact.system',
'impact.input',
'impact.image'
)
.defines(function(){
ig.module(
'plugins.json'
)
.defines(function(){ "use strict";
ig.JSON = ig.Class.extend({
data: null,
path: '',
@phoboslab
phoboslab / OBJLoader.js
Created July 10, 2013 09:08
OBJLoader for Three.js/Ejecta
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.OBJLoader = function () {
THREE.EventDispatcher.call( this );
};
@phoboslab
phoboslab / menus.js
Created November 11, 2012 22:13
Z-Type Menu
ig.module(
'game.menus'
)
.requires(
'impact.font'
)
.defines(function(){
MenuItem = ig.Class.extend({
getText: function(){ return 'none' },
@phoboslab
phoboslab / gist:3939020
Created October 23, 2012 14:21
AnalogStick plugin
ig.module(
'plugins.analog-stick'
)
.requires(
'impact.system'
)
.defines(function(){
ig.AnalogStick = ig.Class.extend({
stickSize: 30,