Skip to content

Instantly share code, notes, and snippets.

$('someform').submit(function() {
var form = $(this);
var out = {};
form.find('input').each(function() {
var input = $(this);
var name = input.attr('name');
var val = input.val();
out[name] = val;
});
$('someform').submit(function() {
var form = $(this);
var out = {};
form.find('input').each(function() {
var input = $(this);
var name = input.attr('name');
var val = input.val();
out[name] = val;
});
@matthewmueller
matthewmueller / cors.js
Last active December 18, 2015 06:08
CORS wherevzzz. Use a proxy server to get around cross-origin issues.
/**
* Simple proxy server to get around cross domain issues
*/
var express = require('express');
var app = module.exports = express();
var request = require('request')
/**
* CORS
@matthewmueller
matthewmueller / .bash_aliases
Last active December 19, 2015 12:19
.bash_aliases
## Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}"
open "http://localhost:${port}/" && python -m SimpleHTTPServer "$port"
}
## Display as a list, sorting by time modified
alias ll='ls -1t'
## Display the insides of a particular directory
.blue {
height: 200px;
width: 100%;
background: #293e81;
}
.white {
height: 200px;
width: 100%;
background: #F7F7F7
@matthewmueller
matthewmueller / zoom.js
Last active December 23, 2015 07:19
transform component of zoom
/**
* Transform
*
* @param {Number} left
* @param {Number} scale
* @param {Number} top
* @return {Zoom}
* @api private
*/
{ 'exiftool version number': '9.37',
'file name': 'screenshot.png',
directory: '.',
'file size': '63 kB',
'file modification date time': '2013:10:12 13:47:47-07:00',
'file access date time': '2013:10:12 13:52:47-07:00',
'file inode change date time': '2013:10:12 13:47:47-07:00',
'file permissions': 'rw-r--r--',
'file type': 'PNG',
'mime type': 'image/png',
@matthewmueller
matthewmueller / array.js
Created November 23, 2013 22:05
array.js + modella = <3
/**
* Module Dependencies
*/
var array = require('array');
var modella = require('modella');
var User = modella('user')
.attr('name', { type: String })
.attr('age', { type: Number })
@matthewmueller
matthewmueller / nw.js
Last active November 27, 2015 20:49
string alignment using the Needleman-Wunsch algorithm
const UP = 1;
const LEFT = 2;
const UL = 4;
function nw(s1, s2, op) {
op = op || {};
const G = op.G || 2;
const P = op.P || 1;
const M = op.M || -1;
var mat = {};