Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / README.md
Last active June 8, 2023 07:45
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

@joyrexus
joyrexus / README.md
Last active August 29, 2015 14:17
go api dev

I'm currently developing a simple go-based web service and a CLI client for it. The following are some useful articles and resources specifically focused on HTTP API development and design, listed here for future reference.

For more general golang web development materials, see this gist.

Tutorials

@joyrexus
joyrexus / README.md
Last active August 29, 2015 14:17
REST basics

Basics of RESTful API design

  • Your API should be designed around the idea of resources.

  • Resources represent things (nouns) and not behaviors (verbs).

  • Each resource should have a canonical/unique url (api/users/bill, api/users/mary).

  • Return all resource properties in the return payload.

@joyrexus
joyrexus / README.md
Created March 13, 2015 20:59
CS basics

At the risk of stating the obvious, any CS major needs a solid understanding of combinatorics, probability, and complexity. Consider studying Concrete Mathematics to bone up on core techniques.

Basic topics you should regularly review (at least before interviewing for a competitive software engineering position):

  • sorting
  • hashing
  • trees
  • graphs
  • concurrency
@joyrexus
joyrexus / README.md
Created March 10, 2015 17:58
auth wrapper for httprouter
@joyrexus
joyrexus / README.md
Created February 23, 2015 22:11
boltdb demo
@joyrexus
joyrexus / README.md
Created February 21, 2015 14:21
Functional config in go

Quick demo of how to initialize your data structure with optional configuration parameters ... with sane defaults if left unspecified.

This functional config technique ...

  • lets you write APIs that can evolve without pain
  • provides meaningful configuration parameters
  • makes it easy to set default settings
  • makes it possible to set complex conditional values
@joyrexus
joyrexus / map.geojson
Created February 20, 2015 16:03
Geojson for St. Luke's Hall
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joyrexus
joyrexus / README.md
Last active April 9, 2023 22:43
golang web dev
@joyrexus
joyrexus / README.md
Last active August 29, 2015 14:15
map and watch location

Initialize a map with the user's current location and update marker position if user's location changes.

See also the Geolocation Marker utility.