Skip to content

Instantly share code, notes, and snippets.

View namlet's full-sized avatar

Nathan Loyer namlet

View GitHub Profile
exports.charge = function(req, res){
var pkg = req.body;
var token = pkg.token;
console.log("POST BODY");
console.log(req.body);
var charge = rk.stripe.charges.create({
amount: 3999, // amount in cents, again
currency: "usd",
card: token.id,
exports.charge = function(req, res){
var pkg = req.body;
var token = pkg.token;
console.log("POST BODY");
console.log(req.body);
var charge = rk.stripe.charges.create({
amount: 3999, // amount in cents, again
currency: "usd",
card: token.id,
<script>
var handler = StripeCheckout.configure({
key: '*****',
//image: '/square-image.png',
token: function(token, args) {
// Use the token to create the charge with a server-side script.
// You can access the token ID with `token.id`
console.log(token);
console.log(args);
var pkg = {'token':token, 'args':args};
@namlet
namlet / gist:a3b5a98513f5b810ae64
Created October 23, 2014 21:08
brew doctor output
brew doctor
Warning: /usr/local/etc isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a brew tries to write a file to this directory, the
install will fail during the link step.
You should probably `chown` /usr/local/etc
Warning: /usr/local/share isn't writable.
This can happen if you "sudo make install" software that isn't managed by
@namlet
namlet / gist:48dc789425b3e0b10d7b
Created January 13, 2015 20:39
Standard Ajax Call Setup
// Setup default behavior (in some init script probably)
$(document).ajaxError(function( event, jqxhr, settings, thrownError ) {
console.log('Ajax Error: ' + thrownError);
console.log('Ajax Error jqXHR: ' + jqxhr);
console.log('Ajax settings: ' + settings);
});
$.ajaxSetup({
dataType: json,
@namlet
namlet / gist:c7558cdd99b429c373cd
Created March 26, 2015 18:35
Take jQuery.serializeArray() and map to custom Object
var serializedArray = [
{name: 'location', value:'Location one'},
{name: 'location', value:'Location two'}
]
// in practice
// var serializedArray = $(form).serializeArray();
var mappedObject = serializedArray.map(function(location){
return { location: location.value };
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
#!/bin/bash
## ABSOLUTE path to the PHP binary
PHPFCGI="/opt/local/bin/php-cgi"
## tcp-port to bind on
FCGIPORT="9000"
## IP to bind on
FCGIADDR="127.0.0.1"
#user nobody;
worker_processes 1;
error_log /opt/local/var/log/nginx/error.log;
pid /opt/local/var/run/nginx.pid;
events {
worker_connections 1024;
}
brahma:shindig nathanloyer$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: content/sampledata/canonicaldb.json
#
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)