Skip to content

Instantly share code, notes, and snippets.

View pwhelan's full-sized avatar

Phillip Whelan pwhelan

View GitHub Profile
@pwhelan
pwhelan / proxyapp.rb
Created July 5, 2012 08:09
ProxyApp for connecting Pow to PHP
require 'net/http'
class ProxyApp
def call(env)
begin
request = Rack::Request.new(env)
headers = {}
env.each do |key, value|
if key =~ /^http_(.*)/i
headers[$1] = value
@pwhelan
pwhelan / DJTTMFPCUEMASTER-SLIPMODE.js
Created May 30, 2012 06:41
DJTTMFPCUEMASTER-SLIPMODE
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
// Remove a vlue from an array
Array.prototype.removeValue = function(value)
{
@pwhelan
pwhelan / gist:2803736
Created May 27, 2012 10:49
A snippet with slip mode for Mixxx
DJTTCueMaster.beatloopInt = function(group, on, beats)
{
if (on) {
if (this.bstk.length == 0) {
var slipmodestatus = {
rate: engine.getValue(group, 'rate'),
startplaypos: engine.getValue(group, 'playposition'),
curplaypos: engine.getValue(group, 'playposition')
};
@pwhelan
pwhelan / MixxxAPI.js
Created May 2, 2012 22:50
Mixxx API (engine.X wrapper)
function MixxxEngineCall(group, control, value)
{
if ( typeof value != 'undefined' )
print("[S] " + group + "::" + control + "=" + value);
else
print("[G] " + group + "::" + control);
if ( typeof value != 'undefined' )
engine.setValue(group, control, value);
@pwhelan
pwhelan / embed-code-script.js
Created May 2, 2012 08:48
Simple script that can be included directly to generate the book now button
var bookNowButtonGenerate = function() {
var open_new_window = function(URL)
{
var opts = "toolbar=no,menubar=0,status=1,copyhistory=0,scrollbars=yes"
",resizable=1,location=0,Width=1065,Height=760";
var click4time_window = window.open('', "_blank", opts);
click4time_window.location = URL;
};
var stepURL = 'https://book.click4time.com/sassonabaron/book/step1';
var imgURL = 'http://book.click4time.com/images/buttons/large_blue_bevel.png';
@pwhelan
pwhelan / embed_book_now-1.html
Created May 2, 2012 08:38
Embed code for Book Now button popup
<script src="https://book.click4time.com/js/cp_window.js"></script>
<a onClick="open_new_window('https://book.click4time.com/sassonabaron/book/step1')" href="#" title="Book Online">
<img src="http://book.click4time.com/images/buttons/large_blue_bevel.png" alt="Book online now" border="0" />
</a>
@pwhelan
pwhelan / gist:2143197
Created March 21, 2012 00:51
Smoothslider
// ----------------- BEGIN SmoothSlider functions -----------------
SmoothSlider = function() {}
SmoothSlider.Step = 0.7;
SmoothSlider.Steps = 127;
SmoothSlider.generateTable = function(mrange, step)
{
var sliderTable = new Array();
var range = Math.round(mrange * 100);
if (( range % 10 ) && (range != 8))
@pwhelan
pwhelan / timed-loop-closure.js
Created February 28, 2012 04:06
Tail Recursion to infinite timed loop in Node.js... with Closures!
function loop() {
var start_date = Date.now()
var old_date = start_date
var seconds_running = 120
var intervalId = setInterval(1000, function() {
new_date = Date.now()
// Execute this for just 30 seconds
if( (new_date - start_date) < 1000 * seconds_running) {