Skip to content

Instantly share code, notes, and snippets.

View bradoyler's full-sized avatar
👋
say hi

brad oyler bradoyler

👋
say hi
View GitHub Profile
@mbostock
mbostock / .block
Last active April 8, 2024 12:20
Voronoi Arc Map
license: gpl-3.0
height: 600
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@Integralist
Integralist / GitHub curl.sh
Last active September 7, 2023 03:53 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@domenic
domenic / portable-node.md
Created May 25, 2012 21:03
Tips for Writing Portable Node.js Code

Node.js core does its best to treat every platform equally. Even if most Node developers use OS X day to day, some use Windows, and most everyone deploys to Linux or Solaris. So it's important to keep your code portable between platforms, whether you're writing a library or an application.

Predictably, most cross-platform issues come from Windows. Things just work differently there! But if you're careful, and follow some simple best practices, your code can run just as well on Windows systems.

Paths and URLs

On Windows, paths are constructed with backslashes instead of forward slashes. So if you do your directory manipulation

@joseluisq
joseluisq / generators-vs-asyncawait-vs-native-promises.js
Last active April 26, 2021 11:52 — forked from netroy/generators-vs-asyncawait-vs-native-promises.js
Native Promises vs Generators vs Async/Await Performance vs Bluebird Promises
const Benchmark = require('benchmark')
const co = require('co')
const bluebird = require('bluebird')
const suite = new Benchmark.Suite
suite
.add('co generators', {
defer: true,
fn: deferred => {
@cmgiven
cmgiven / .block
Created August 15, 2016 16:11
Demers Cartogram
license: mit
height: 600
@rveciana
rveciana / README.md
Last active May 15, 2019 15:36
Congressional representatives dataset

Based on this data, contains a Shapefile and two topojson with the US congressional Districts.

The atlas-make project has a better maintained version of this data.

The difference from the data is based on, is that the American Samoa, Guam and Northern Marianas are included from the Natural Earth dataset. The Congress Representative data is included too.

get_areas.py is a script to calculate the area paoperties for the new objects. The name of the Congressional Representatives in the added territories has been taken from the Wikipedia.

The topojson has been calculated using the command: topojson -o us_congressional_district.json cgd114p010g.shp -p

@markselby
markselby / node-express-redis-cache.js
Created October 28, 2013 02:19
Add Redis request caching to Node.js with Express.js.
var zlib = require('zlib');
var redis = require('redis');
var redisClient = redis.createClient();
var crypto = require('crypto');
// Our custom caching write function
function cached(body, lifetime, type) {
var key = this.req.originalUrl;
var res = this;
var etag, len;
@mbostock
mbostock / .block
Last active September 26, 2018 01:31
Projected TopoJSON
license: gpl-3.0
height: 800
@aendra-rininsland
aendra-rininsland / GoT-screentimes--s06.json
Last active September 7, 2017 13:33
Game Of Thrones total screentimes (Up to and including Season 6)
[
{
"name": "Tyrion Lannister",
"imdbUrl": "http://www.imdb.com/character/ch0146096/",
"screentime": 293.3,
"episodes": 54,
"portrayedBy": {
"name": "Peter Dinklage",
"imdbUrl": "http://www.imdb.com/name/nm0227759/"
}