Skip to content

Instantly share code, notes, and snippets.

@fendent
fendent / gist:5715568
Created June 5, 2013 17:15
Example of scripting in NextLevel
nl.script
.start(this)
.flag('talk', true)
.say(
"Welcome to the NextLevel demo test!",
"There's not much to see here right now but feel free to poke around."
)
.haltInput()
.pause(500).face(turnDirection1)
.pause(500).face(turnDirection2)
@fendent
fendent / xbox360hid.h
Created June 4, 2013 21:41
The XBox360 HID descriptor
char ReportDescriptor[196] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x05, // USAGE (Game Pad)
0xa1, 0x01, // COLLECTION (Application)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x3a, // USAGE (Counted Buffer)
0xa1, 0x02, // COLLECTION (Logical)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x02, // REPORT_COUNT (2)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
@fendent
fendent / Controller.cpp
Created June 4, 2013 21:38
Some definitions for the XBox 360 Rock Band Stage Kit OS X drivers
#ifndef __CONTROLSTRUCT_H__
#define __CONTROLSTRUCT_H__
typedef UInt8 XBox360_Byte;
typedef UInt16 XBox360_Short;
typedef SInt16 XBox360_SShort;
#define Xbox360_Prepare(x,t) {memset(&x,0,sizeof(x));x.header.command=t;x.header.size=sizeof(x);}
#define PACKED __attribute__((__packed__))
" Needs to go here to supress NERDTree
set shortmess=lstI
runtime bundle/vim-pathogen/autoload/pathogen.vim
" Bundle: tpope/vim-pathogen
call pathogen#infect()
" ### Miscellaneous
" Bundle: scrooloose/nerdtree
" Bundle: majutsushi/tagbar
@fendent
fendent / vim-update-bundles.rb
Created April 17, 2013 23:55
VIM bundle manager
#!/usr/bin/env ruby
# Reads bundles to be installed from the .vimrc file then synchronizes
# .vim/bundles by downloading new repositories as needed. It also removes
# bundles that are no longer used.
# This software is covered by the MIT License.
require 'fileutils'
require 'open-uri'
@fendent
fendent / gist:4481911
Created January 8, 2013 07:09
bookmarklet to add a G. because it is the funniest letter
javascript:void((function(d){var g=d.createElement('div');g.setAttribute('style','position:fixed;top:0.2em;left:0.3em;font-family:Impact,sans-serif;color:#222;text-shadow:5px 5px 0px #dfdfdf;font-size:72px');g.innerHTML='G';d.getElementsByTagName('body')[0].appendChild(g)}(document)))
@fendent
fendent / fireNext.js
Last active September 30, 2015 09:37
real 0ms setTimeout() / setImmediate()
/**
* fireNext(function() { ... });
*
* Uses postMessage() instead of setTimeout() to achieve a ~0ms timer
* Sean Murphy - https://gist.github.com/1760684
*
* Edit 01/13: Apparently the kids call this setImmediate().
*/
(function(id, q, w) { w.addEventListener('message', function(e) {
@fendent
fendent / gist:1754448
Created February 6, 2012 19:59
cross-browser console.log implementation
/**
* Simple cross-browser console.log implementation
*
* Sean Murphy - https://gist.github.com/1754448
*/
(function (x, w, o, join) { w.console = w.console || x;
x.log = x.warn = x.info = x.error = o ? o.postError :
function log() { alert(join.call(arguments, ' ')) };
})({}, window, window.opera, Array.prototype.join);