Skip to content

Instantly share code, notes, and snippets.

View mygoare's full-sized avatar
:octocat:

Gore mygoare

:octocat:
View GitHub Profile
@mygoare
mygoare / vue-nginx.conf
Created July 14, 2019 08:43 — forked from namdau/vue-nginx.conf
Nginx config for Vuejs project with an API upstream
server {
server_name default_server;
# This is for Let's Encrypt certification renewal
include /etc/nginx/snippets/letsencrypt.conf;
# Redirect to https
location / {
return 301 https://$server_name$request_uri;
}
}
@mygoare
mygoare / README.md
Created January 12, 2016 02:48 — forked from joyrexus/README.md
form-data vs -urlencoded

Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded and multipart/form-data.

“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data. Otherwise, use application/x-www-form-urlencoded.”


Matt Bridges' answer in full:

The MIME types you mention are the two Content-Type headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing

@mygoare
mygoare / mp3player.js
Created October 30, 2015 03:31 — forked from TooTallNate/mp3player.js
node.js command line MP3 player in 9 lines of code!
var fs = require('fs');
var lame = require('lame');
var Speaker = require('speaker');
fs.createReadStream(process.argv[2])
.pipe(new lame.Decoder())
.on('format', function (format) {
this.pipe(new Speaker(format));
});
@mygoare
mygoare / ES5 Newnewss
Last active August 29, 2015 14:18 — forked from sym3tri/ES5 Newnewss
es5 features
- Trailing commas are ok
- No reserved words for property names
- NaN, Infinity, undefined : are all constants
- parseInt() defaults to radix 10
- /regexp/ produces new reg ex object every time
- JSON.parse(), JSON.stringify()
- Function.prototype.bind
- String.prototype.trim
- Array.prototype.every, filter, forEach, indexOf, lastIndexOf, map, reduce, reduceRight, some,
- Date.now()
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
#line{
width: 700px;
margin: 20px 0;
height: 300px;
background: #eee;
@mygoare
mygoare / README.md
Created April 14, 2014 08:10 — forked from mbostock/.block
Learn to write d3 plugin

Designed by Stephen Few, a bullet chart “provides a rich display of data in a small space.” A variation on a bar chart, bullet charts compare a given quantitative measure (such as profit or revenue) against qualitative ranges (e.g., poor, satisfactory, good) and related markers (e.g., the same measure a year ago). Layout inspired by Stephen Few. Implementation based on work by Clint Ivy, Jamie Love of N-Squared Software and Jason Davies. The "update" button randomizes the values slightly to demonstrate transitions.

@mygoare
mygoare / README.md
Created April 11, 2014 08:28 — forked from mbostock/.block
Learn to Custom d3 brush handle style

This example demonstrates how to add visible and draggable handles to D3’s d3.svg.brush component, rather than that relying on the invisible boundary of the brush extent. The handle sizes here are exaggerated for demonstration purposes!