Skip to content

Instantly share code, notes, and snippets.

🏳️‍🌈
I made `pride-archive` to capture companies supporting LGBT+ Pride Month.

Jeremiah Lee jeremiahlee

🏳️‍🌈
I made `pride-archive` to capture companies supporting LGBT+ Pride Month.
Block or report user

Report or block jeremiahlee

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeremiahlee
jeremiahlee / now.json
Last active Mar 13, 2019
Configure static hosting on Zeit to have securityheaders.com’s recommended security headers
View now.json
{
"name": "TODO-put-your-project-name-here",
"alias": [
"TODO-put-your-domain-here.com",
"www.TODO-put-your-domain-here.com"
],
"static": {
"headers": [
{
"source": "**/*.@(html)",
View extractFragmentQueryParameters.js
var fragmentQueryParameters = {};
window.location.hash.slice(1).replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { fragmentQueryParameters[$1] = $3; }
);
// Access fragment query parameters in fragmentQueryParameters object, e.g. fragmentQueryParameters.access_token
@jeremiahlee
jeremiahlee / webhooks-with-hapi.js
Created Oct 18, 2015
Webhook receiver with hapi.js
View webhooks-with-hapi.js
/*
Webhook receivers should accept a request and immediately respond with HTTP 204 No Content before processing the request. Here's how to do this with hapi.js.
Start this server:
`node webhooks-with-hapi.js`
Then make a request:
`curl http://localhost:8000/webhook-receiver -v`
Note the correct behavior: HTTP response will be sent and connection closed before the webhook processing starts.
@jeremiahlee
jeremiahlee / colons-in-cookie-names.md
Last active Dec 3, 2018
Can you use a colon in the name of a cookie?
View colons-in-cookie-names.md
@jeremiahlee
jeremiahlee / 12-hour-time-regex-validation.txt
Last active Aug 29, 2015
12 hour time regex validation
View 12-hour-time-regex-validation.txt
^(1[0-2]|0?[1-9]):([0-59]{2}) (AM|PM)$
View Running Ubuntu Server headless in Parallels Desktop
# List available VMs
prlctl list --all
# Start a VM using its name
prlctl start UbuntuServer
# Stop the VM
prlctl stop Fitbit
# Pause and Resume
View recursion-example-array-input.html
<!--
Given the document below, create a JS object like:
{
name: "html",
childNodes: [
{
name: "head",
childNodes: [
{
View recursion-example-item-input.html
<!--
Given the document below, create a JS object like:
{
name: "html",
childNodes: [
{
name: "head",
childNodes: [
{
@jeremiahlee
jeremiahlee / gist:3764457
Created Sep 21, 2012
Awesm share to Twitter intent
View gist:3764457
function share(text) {
window.location = 'https://api.awe.sm/url/share?v=3'
+ '&url=' + encodeURIComponent('http://YOUR-URL-TO-SHARE.com/right/here')
+ '&key=YourAPIKeyHere'
+ '&tool=AehFJd'
+ '&channel=twitter'
+ '&destination=' + encodeURIComponent('https://twitter.com/intent/tweet?text=' + encodeURIComponent(text) + 'AWESM_URL'); // Twitter's "intent" pop-up URL, double URL encoded
}
@jeremiahlee
jeremiahlee / object-oriented-javascript.js
Created Jul 2, 2012
Awe.sm Interview Question: Object Oriented JavaScript
View object-oriented-javascript.js
// Prototypal Inheritance is awesome! Less memory. Ridiculously faster.
// Not `var Animal = function() {}`, as `function Animal()` gets hoisted
function Animal(species, noise) {
this.species = species || 'unclassified'; // falsey values get default value
this.noise = noise || 'unrecorded';
}
Animal.prototype.makeNoise = function() {
console.log(this.species + ': ' + this.noise);
}
You can’t perform that action at this time.