Skip to content

Instantly share code, notes, and snippets.

@chrisallick
chrisallick / gist:1166001
Created August 23, 2011 17:58 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job:
Interactive Developer at Rockwell Labs: http://lab.rockwellgroup.com/ http://www.rockwellgroup.com/projects/view/category/interactive
I am responsible for all backend software design, api development and architecting software for permanent installations. I also do a ton of JavaScript on the front end, but who cares?!
Favorite Python project:
Only one? HellaNZB, Pyjamas, App Engine, Tornado, YouTube Subtitle Search Engine: http://chrisallick.webfactional.com/subsearch
Favorite Conference:
// taken from Best in Class
onYouTubePlayerReady = function( playerId ) {
ytplayer = document.getElementById( "myytplayer" );
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
ytplayer.playVideo();
//t = setTimeout( transition, 500 );
}
onYouTubePlayerReady = function( playerId ) {
ytplayer = document.getElementById( "video_container" );
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
ytplayer.addEventListener("onError", "onytplayerError");
ytplayer.playVideo();
}
function onytplayerStateChange(newState) {
if( newState == 0 ) {
function render() {
rotation.x += ( target.x - rotation.x ) * 0.05;
rotation.y += ( target.y - rotation.y ) * 0.05;
distance += ( distanceTarget - distance ) * 0.05;
camera.position.x = distance * Math.sin( rotation.x ) * Math.cos( rotation.y );
camera.position.y = distance * Math.sin( rotation.y );
camera.position.z = distance * Math.cos( rotation.x ) * Math.cos( rotation.y );
if( cubes.length > 0 ) {
@chrisallick
chrisallick / gist:3648116
Created September 5, 2012 23:57
Force preload of video in HTML5
function addSourceToVideo(element, src, type) {
var source = document.createElement('source');
source.src = src;
source.type = type;
element.appendChild(source);
}
var video;
@chrisallick
chrisallick / gist:3648196
Created September 6, 2012 00:01
faster prebuffer of scrubbing
function addSourceToVideo(element, src, type) {
var source = document.createElement('source');
source.src = src;
source.type = type;
element.appendChild(source);
}
var video;
@chrisallick
chrisallick / gist:3680740
Created September 8, 2012 23:02
remove ds_store
There are a few solutions to resolve this problem. Below is a list of options:
To avoid creating .DS_Store files, do not to use the OS X Finder to view folders. An alternative way to view folders is to use UNIX command line.
To remove the .DS_Store files a third-party product called DS_Store Terminator can be used.
To delete the .DS_Store files from the entire system a UNIX shell command can be used.
Launch Terminal from Applications:Utilities
At the UNIX shell prompt enter the following UNIX command:
sudo find / -name ".DS_Store" -depth -exec rm {} \;
When prompted for a password enter the Mac OS X Administrator password.
@chrisallick
chrisallick / gist:3746185
Created September 18, 2012 21:57
check x and y to handle leave event properly drag and drop html5
$('#draganddrop-wrapper').hide();
$(document).bind('dragenter', function(event) {
$('#draganddrop-wrapper').fadeIn(500);
return false;
});
$("#draganddrop-wrapper").bind('dragover', function(event) {
return false;
}).bind('dragleave', function(event) {
@chrisallick
chrisallick / gist:3746962
Created September 19, 2012 00:41
simple upward wandering particles
var canvas, ctx, ps, w, h;
function Particle( _parent, _x, _y, _v, _s ) {
this.x = _x;
this.originalX = _x;
this.y = _y;
this.toY = 0;
this.scale = _s;
@chrisallick
chrisallick / gist:3765584
Created September 22, 2012 08:54
main_wss.py
import logging
import tornado.escape
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.websocket
import os.path
from tornado.options import define, options