Skip to content

Instantly share code, notes, and snippets.

package main
import (
"os"
"fmt"
"net/http"
"io/ioutil"
"log"
"time"
)
@morrow
morrow / letsrevolutionizetesting.js
Last active December 29, 2015 00:29
compiled javascript solution for the letsrevolutionizetesting.com code puzzle
var getNextUrl;
getNextUrl = function(url) {
if (url == null) {
url = "challenge";
}
return $.getJSON(url, function(r) {
if (r.follow) {
getNextUrl(r.follow);
}
@morrow
morrow / letsrevolutionizetesting.coffee
Last active December 29, 2015 00:29
CoffeeSecript source code for the letsrevolutionizetesting.com code puzzle
getNextUrl = (url="challenge") ->
$.getJSON url, (r) ->
getNextUrl(r.follow) if r.follow
console.log r
@morrow
morrow / app.js
Created December 6, 2011 04:50
Bookmarklet to simulate the mechanics of the video site colour.com on youtube
/* What it does on the page of a given youtube.com video:
- Loads the HTML5 version of the current video if necessary/possible.
- Mutes the video.
- Stops the video after 30 seconds.
- Changes the youtube logo to the colour.com one.
Why? As a silly experiment to see what it's like to view muted videos limited to 30 seconds in length (the basic experience of video sharing on colour.com for now).
*/
if (!window.location.href.match(/html5/)) {
alert("Hit this bookmarklet again once the window has re-loaded:)");
window.location.href = window.location.href + "&html5=1"
@morrow
morrow / searchHNComments.bookmarklet.js
Created October 17, 2011 21:48
Search HN Comments
javascript:var query=/^username$/;var color="#FF3300";var offset=-10;if(!window.hnComments||!window.hnComments.length){window.hnComments=[];window.hnIndex=0;}for(x=0;x<document.getElementsByClassName("comhead").length;x++){var element=document.getElementsByClassName("comhead")[x].childNodes[0];var username=element.innerHTML;if(username&&username.match(query)&&window.hnComments.indexOf(element)<0){window.hnComments.push(element);element.style.color=color;}}if(window.hnComments&&typeof(window.hnComments[window.hnIndex])=="object"){window.hnComments[window.hnIndex].scrollIntoView();window.setTimeout("window.scrollBy(0,"+offset+");",1);window.hnIndex++;if((window.hnIndex)>=window.hnComments.length){window.hnIndex=0;}}
@morrow
morrow / g-plus-comment-linker-bookmarklet.js
Created September 4, 2011 18:33
Google Plus Link to Comments Directly (no longer working with new versions of googleplus)
javascript:(function(){alert("Click the text of the comment you want a link to.");document.body.onclick=function(e){var clearance_height,element,id,offset_height,post,sibling_cursor,sibling_element,sibling_elements,sibling_ids,url,_i,_j,_len;element=e.toElement;_i=10;while(_i>0&&!id){if(element.parentNode&&element.parentNode.className==="qx rg"){id=element.parentNode.id;}element=element.parentNode;_i--;}sibling_ids=[];sibling_elements=element.parentNode.getElementsByClassName("qx rg");clearance_height=0;offset_height=0;if(window.innerHeight>=530){clearance_height+=document.getElementById("gb").offsetHeight||30;}if(window.innerHeight>=800){clearance_height+=document.getElementsByClassName("c-cb-V c-i-cb-V c-cb-V-Fi")[0].offsetHeight||60;}for(_j=0,_len=sibling_elements.length;_j<_len;_j++){sibling_element=sibling_elements[_j];sibling_ids.push(sibling_element.id);}sibling_cursor=sibling_ids.indexOf(element.id);while(offset_height<clearance_height&&sibling_cursor>0){sibling_cursor-=1;offset_height+=sibling_elemen