Skip to content

Instantly share code, notes, and snippets.

@z-------------
z------------- / randomBG.js
Created March 27, 2014 00:07
Gives the <body> a random background color
var e=Math.random()*255,
t=Math.random()*255,
n=Math.random()*255;
document.body.style.backgroundColor="rgb("+Math.round(e)+","+Math.round(t)+","+Math.round(n)+")"
@z-------------
z------------- / ytFullscreen.js
Created March 27, 2014 00:09
Open a YouTube video in the embed view
(function(e){
var t = e.substring(e.indexOf("v=") + 2, e.indexOf("v=") + 13);
if (e.indexOf("youtube.com/watch") != -1) {
window.location = "http://www.youtube.com/embed/" + t + "?autohide=1";
} else {
alert("You can only use this on YouTube videos, silly");
}
})(location.href)
@z-------------
z------------- / searchCurrentSite.js
Created March 27, 2014 00:10
Search the current site with Google
(function(e){
var t = prompt("What do you want to find on " + e + "?");
window.location = "//www.google.com/search?q=site:" + e + "+" + t;
})(location.hostname)
@z-------------
z------------- / download.sh
Last active August 29, 2015 13:57
My first dive into the world of shell scripting...
#!/bin/bash
# download.sh <dir> <file1> <file2>...
tempDir="$1"
#make folder and cd to it
mkdir $tempDir
cd $tempDir
@z-------------
z------------- / timer.sh
Last active August 29, 2015 13:57
Exceedingly simple bash timer
#!/bin/bash
# timer.sh <start> <interval>
start="$1"
interval="$2"
for ((i=$start;i>=1;i--))
do
printf "$i "
@z-------------
z------------- / Array-contains.js
Last active August 29, 2015 13:58
Adds an Array function to test if an array contains a particular value
Array.prototype.contains = function(q){if(this.indexOf(q) != -1){return true}else{return false}}
//["waffles",3.14,"pie"].contains(3.14) --> true
//["waffles",3.14,"pie"].contains("foo") --> false
@z-------------
z------------- / rnd-rgb.js
Created April 7, 2014 03:07
Returns a random RGB color
var rndRGB = function(type){
var r = Math.round(Math.random()*255);
var g = Math.round(Math.random()*255);
var b = Math.round(Math.random()*255);
switch (type) {
case "array":
return [r,g,b]; break;
case "formatted":
return "rgb("+r+","+g+","+b+")"; break;
default:
@z-------------
z------------- / querySelector-shorthand.js
Created April 7, 2014 03:11
Do $$(selector) instead of document.querySelector(selector). Just saves a lot of time.
var $$ = function(sel) {
return document.querySelector(sel);
}
var $$$ = function(sel) {
return document.querySelectorAll(sel);
}
// $$ is equivalent to querySelector
// $$$ is equivalent to querySelectorAll
java -Xmx2G -jar craftbukkit.jar -o false
pause
cd /System/Library/Fonts
cp HelveticaNeue.dfont /Users/eddy/Desktop