Skip to content

Instantly share code, notes, and snippets.

Avatar

Johan Sundström johan

View GitHub Profile
View Inglehart_Values_Map2.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johan
johan / mix-warn
Created April 18, 2015 00:16
mixed-content warnings finder
View mix-warn
#! /usr/bin/env phantomjs
var webpage = require('webpage')
, system = require('system')
, fs = require('fs')
, _ = require('underscore')
, URLS, MULTIPLE, OPTS = {}, OPTIONS =
{ '-v': 'verbose'
};
@johan
johan / list-app-widgets
Last active August 29, 2015 14:20
Two osascript hacks to inventory osx application object models, for osascripting them from shell scripts
View list-app-widgets
#! /bin/sh
# lists all widgets of the app named $1 to stdout
# You will probably need to first add Terminal.app here (osx Yosemite; 10.10.3):
# System Preferences -> Security & Privacy -> Privacy -> Accessibility
osascript \
-e 'tell application "'$1'" to activate' \
-e 'tell application "System Events" to tell process "'$1'" to set output to entire contents of front window' \
@johan
johan / reader
Last active August 29, 2015 14:20
Osascript shell hack to engage "Reader View" after loading a url in Safari
View reader
#! /usr/bin/osascript
# opens url $1 in Safari and tries to engage its Reader View (if it shows up within 15s)
# You will probably need to first add Terminal.app here (osx Yosemite; 10.10.3):
# System Preferences -> Security & Privacy -> Privacy -> Accessibility
on run argv
set article_url to item 1 of argv
@johan
johan / README.md
Last active August 29, 2015 14:25 — forked from mbostock/.block
View README.md

Hourly solar analemmas (ignoring daylight savings time) as seen from San Francisco in 2014.

@johan
johan / index.html
Last active August 29, 2015 14:26
Sleep visualization based on massaged data excerpts from Sleep Time app
View index.html
<div id="sleep"></div>
@johan
johan / README.md
Last active August 31, 2015 08:26
Movielens guesses as to how I'd rate HBO now movies
View README.md

Cross-referencing HBO movies with Movielens data

I decided to try that free month of HBO Now this weekend. It didn't have more than 377 movies when I checked, and it had no way of guessing at what I'd like. Fortunately for me, I have an old Movielens account, which has a fair idea of things I like, so I figured I'd cross-reference the HBO inventory with their guesses at what I'd like, given what I've seen and liked or disliked.

View GM-purpose
User scripts, ultimately, serve whatever purposes scriptwrights and user script
users have.
On a higher level, though, they evolve and democratize the web faster and sooner
-- by letting anyone and everyone partake in extending, improving, specializing,
generalizing and/or otherwise fitting it better to their needs and wants, by
themselves, without (at least technically) ever needing to ask anyone's
permission, or having any privileged access to the servers that deliver web
content and functionality.
@johan
johan / Github-unfold-commit-history.user.js
Created May 25, 2010 18:45
Userscript that adds an "unfold all changesets" button on Commit History pages at github, which lets you browse the source changes without leaving the page. (Click a commit header again to re-fold it.)
View Github-unfold-commit-history.user.js
// ==UserScript==
// @name Github: unfold commit history
// @namespace http://github.com/johan/
// @description Adds an "unfold all changesets" button on Commit History pages at github, which lets you browse the source changes without leaving the page. /Click a commit header again to re-fold it.)
// @include https://github.com/*/commits/*
// @include http://github.com/*/commits/*
// ==/UserScript==
(function() {
if ('undefined' == typeof __PAGE_SCOPE_RUN__) { // unsandbox, please!
View Github-unfold-commit-history.user.js
// ==UserScript==
// @name Github: unfold commit history
// @namespace http://github.com/johan/
// @description Adds an "unfold all changesets" button on Commit History pages at github, which lets you browse the source changes without leaving the page. /Click a commit header again to re-fold it.)
// @include https://github.com/*/commits/*
// @include http://github.com/*/commits/*
// ==/UserScript==
(function() {
if ('undefined' == typeof __PAGE_SCOPE_RUN__) { // unsandbox, please!