Skip to content

Instantly share code, notes, and snippets.

@ppk asks: “OK, suggestions for my next bit of research?” — https://twitter.com/ppk/status/587545743625478144

@rem replies: “@ppk storage. What works in browser, what browsers, what phones, how it changes when *added to home screen", limits, etc. How's that?” — https://twitter.com/rem/status/587566978065367040

Here’s what I whipped up, please add more in the comments:

APIs:

@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@rnewson
rnewson / gist:dbe91d7beea3cf928e09
Last active December 8, 2016 18:29
notes on rPI PIA VPN
# fresh raspbian image
# I'm using the Edimax EW-7811UN (http://www.amazon.co.uk/gp/product/B003MTTJOY)
# which requires a custom hostapd. I expect there are better options now that Just Work.
# Initial setup
expand partition
expand filesystem
memory split to 32
configure sshd to publickey only (and add your key...)
@mathisonian
mathisonian / index.md
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@weapp
weapp / nginx.conf
Created August 4, 2014 17:21
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
}
@wkjagt
wkjagt / audio-book-reader.md
Last active April 12, 2024 14:18
How I built an audio book reader for my nearly blind grandfather

#How I built an audio book reader for my nearly blind grandfather

Tweet this - Follow me

Last year, when visiting my family back home in Holland, I also stopped by my grand-parents. My grand-father, now 93 years old, had always been a very active man. However, during the presceding couple of months, he'd gone almost completely blind and now spent his days sitting in a chair. Trying to think of something for him to do, I suggested he try out audio books. After finally convincing him -- he said audio books were for sad old people -- that listening to a well performed recording is actually a wonderful experience, I realized the problem of this idea.

####The problem with audio devices and the newly blind. After my first impulse to jump up and go buy him an

@rnewson
rnewson / haproxy.cfg
Last active November 18, 2021 22:12
haproxy.cfg stanzas to enable Perfect Forward Secrecy and HTTP Strict Transport Security. Requires OpenSSL 1.0.1g or so.
# Bind SSL port with PFS-enabling cipher suite
bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:!MD5:!aNULL:!DH:!RC4
# Distinguish between secure and insecure requests
acl secure dst_port eq 443
# Mark all cookies as secure if sent over SSL
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure
# Add the HSTS header with a 1 year max-age
@dwtkns
dwtkns / README.md
Last active April 19, 2020 22:30
Faux-3d Shaded Globe

Faux-3d SVG globe using d3.geo.orthographic and a few radial gradients. Labels offset or hidden based on radians from current map center to enhance the effect.

Uncomment svg.append("g").attr("class","countries") for hover-able country outlines.

@remy
remy / hang.js
Created November 30, 2012 13:23
How to hang JavaScript (useful - to me - for slowing down code and testing)
function hang(n) {
var x = new XMLHttpRequest();
x.open('GET', 'http://hang.nodester.com/script.js?' + n, false);
x.send();
}
// usage: hang(2 * 1000);
@jasondavies
jasondavies / index.html
Created September 10, 2012 08:33
longscroll.js
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.longscroll {
overflow-y: auto;
width: 480px;
height: 500px;
float: left;
}
.longscroll .row {