Skip to content

Instantly share code, notes, and snippets.

@hughpearse
hughpearse / simplified-page-chrome-android.md
Last active July 31, 2023 13:00
Android Bookmarklet - Reader View (Simplified Page)

Android Bookmarklet - Reader View (Simplified Page)

In chrome on android the "Simplified Page" feature does not have a button. If for some reason the browser decides not to display the layover toast message to access this feature, then the user is unable to enter "simplified view". The solution to this problem has been discussed before on Stack Overflow here, where they suggest opening a url to access a local resource on the browser cache. The local resource URL is formatted as follows:

chrome-distiller://<UUID>_<HASH>/?url=<URL>

It is not permitted to perform a javascript redirect to a local resource in the browser, however it is possible to display the URL as text.

@nternetinspired
nternetinspired / gist:7482445
Last active February 24, 2022 17:20
Load Disqus comments only on demand if you give a shit about page weight and your visitors. Even with no comments, i.e. an empty comment form, calling Disqus will load an extra 226Kb. If your page has comments this can be far higher. This Gist accompanies my blog post: http://internet-inspired.com/wrote/load-disqus-on-demand/
// Requires jQuery of course.
$(document).ready(function() {
$('.show-comments').on('click', function(){
var disqus_shortname = 'YOUR-DISQUS-USERNAME'; // Replace this value with *your* username.
// ajax request to load the disqus javascript
$.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
@oscarrenalias
oscarrenalias / nodeproxy.js
Created October 29, 2011 11:43
A very simple Node HTTP proxy that proxies requests to the server given in the GET or POST URL. Heavily inspired by http://www.catonmat.net/http-proxy-in-nodejs/.
//
// How to use:
//
// 1. Start node:
// node nodeproxy.js
// 2. Send a URL like this:
// http://localhost:8080/http://www.google.com
//
// Watch www.google.com come through your local HTTP proxy.
//