This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: '_' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# chkconfig: 35 99 99 | |
# description: Node.js /home/nodejs/sample/app.js | |
# | |
. /etc/rc.d/init.d/functions | |
USER="nodejs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 || ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
OlderNewer