Skip to content

Instantly share code, notes, and snippets.

@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 / 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,
@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(){
@phoboslab
phoboslab / touch-button.js
Last active August 10, 2021 14:44
Touch Button Plugin for Impact
ig.module(
'plugins.touch-button'
)
.requires(
'impact.system',
'impact.input',
'impact.image'
)
.defines(function(){ "use strict";
@phoboslab
phoboslab / mousemove.py
Created June 26, 2012 19:44
Python script to move the mouse cursor in windows with constant speed
import sys
import time
import win32api
if (len(sys.argv) < 4):
print "Usage: python mousemove.py dx dy speed"
sys.exit()
current = win32api.GetCursorPos()
cx = sx = current[0]
@phoboslab
phoboslab / setAnimation.js
Created May 6, 2012 22:04
setAnimation; a sensible requestAnimation polyfill
// rAF polyfill based on https://gist.github.com/1579671
(function(w) {
"use strict";
// Find vendor prefix, if any
var vendors = ['ms', 'moz', 'webkit', 'o'];
for( var i = 0; i < vendors.length && !w.requestAnimationFrame; i++ ) {
w.requestAnimationFrame = w[vendors[i]+'RequestAnimationFrame'];
}