Skip to content

Instantly share code, notes, and snippets.

View alloyking's full-sized avatar
🎧
.

Tim Shultis alloyking

🎧
.
View GitHub Profile
@alloyking
alloyking / s3upload.js
Created May 2, 2012 13:13 — forked from masylum/s3upload.js
Upload files directly to s3
function upload (req, res) {
var Formidable = require('formidable'),
form = new Formidable.IncomingForm();
form.encoding = 'utf-8';
form.onPart = function (part) {
if (!part.filename) {
form.handlePart(part);
} else {
(function () {
@alloyking
alloyking / gist:4162832
Created November 28, 2012 17:47 — forked from boucher/gist:1750368
Stripe sample checkout form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
// Require.js allows us to configure shortcut alias
require.config({
// The shim config allows us to configure dependencies for
// scripts that do not call define() to register a module
shim: {
'socketio': {
exports: 'io'
},
'underscore': {
exports: '_'
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
/**
* The functional pattern, defined in Douglas Crockford's "Javascript: The Good Parts", allows for
* JavaScript to achieve both inheritance and information hiding (private variables) with a compact syntax.
* The specification that is passed in, as well as potentially more vars you may define in each pseudo-class, are not
* accessible from the object that is returned, we consider these private variables. Public vars may
* be added to the "that" return object as desired.
*/
/**
* Person is our base pseudo-class
// all objects inherit from Object.prototype,
// we can add capabilities like so:
console.log('adding capabilities to Object.prototype');
if (typeof Object.prototype.totalBills != 'function') {
Object.prototype.totalBills = function () {
if (this.bills && this.bills.constructor === Array) {
var total = 0;
for (var i=0; i<this.bills.length; i++) {
/**
* Constructor Invocation Pattern
* Requires use of the "new" keyword, allows for inheritance, but no information hiding
* The Functional Pattern is recommended over the Constructor Invocation Pattern
*/
// create a constructor function for the base class
var Person = function (spec) {
// pseudo-class vars
spec.name = spec.name || '';
<?php
/*
Plugin Name: Remote Login
Description: Log into the site with creds that work on remote site (as defined in plugin). The remote site must have XML-RPC enabled.
Author: Kailey Lampert
Author URI: http://kaileylampert.com/
THIS IS NOT COMPLETE - DO NOT USE IN PRODUCTION
The remote site (defined below in $server) is the "master" site.
<?php
/*
Plugin Name: Authenticate Users Remotely
Author: Christopher Davis
Author URI: http://www.christopherguitar.net/
License: GPL2
*/
add_filter('xmlrpc_methods', 'wpse39662_add_login_method' );
/**
@alloyking
alloyking / install_ffmpeg_ubuntu.sh
Last active February 25, 2016 15:51 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377 && https://gist.github.com/xdamman/e4f713c8cd1a389a5917
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Add multiverse. Not all deps are in the main repo
sudo apt-add-repository multiverse && sudo apt-get update