Skip to content

Instantly share code, notes, and snippets.

View hughrawlinson's full-sized avatar

Hugh Rawlinson hughrawlinson

View GitHub Profile
@hughrawlinson
hughrawlinson / README.md
Last active March 18, 2016 16:06
New and improved, in Javascript everything's a cat.

Cat.js

Replaces all the images on a webpage with pictures of cats. Now in ES2015!

@hughrawlinson
hughrawlinson / dogepoem.doge
Last active February 11, 2016 11:44
much dogescript, many error, wow
shh much dogcodez, many errorz, wow
very dog is 'shit zoo'
such woofDog
plz console.loge with dog
wow
while(dog == 'shit zoo'){
rly 0.9 <= Math.random()
@hughrawlinson
hughrawlinson / bogo-bruteforce.js
Last active February 11, 2016 11:46
Bogo brute force example
function makepw(){
var text = "";
var len = random(1,15)
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < len; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
@hughrawlinson
hughrawlinson / logComments.js
Last active December 20, 2015 05:28
A short script to log html comments on a webpage, for use in a bookmarklet.
var content = document.body.innerHTML;;
var comments = content.match(/<!--.*?-->/g);
if(comments!=null|comments!=undefined){
for (var x = 0; x < comments.length;x++){
console.log(comments[x]);
}
}
else{
console.log('No Comments');
}
@hughrawlinson
hughrawlinson / crossfade.js
Last active February 11, 2016 11:45
Web Audio Crossfader
var vineVideoElement = document.getElementById('vineVideo');
var instVideoElement = document.getElementById('instVideo');
var instGain;
var vineGain;
window.AudioContext = window.AudioContext||window.webkitAudioContext;
var context = new AudioContext();
function initCrossfade(){
vineVideoElement.play();
instVideoElement.play();
@hughrawlinson
hughrawlinson / server.js
Last active February 11, 2016 11:46
A Node server for showing temperature from a sensor on a Raspberry Pi
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('<html><body><h1>Welcome to W1-TempServ</h1>\n');
var temp = '';
fs.readFile('/home/simon/temp', 'utf8', function (err, data) {
if (err) throw err;
console.log(data);
res.write("<p>"+data+"</p></body></html>");
res.end();
});