Skip to content

Instantly share code, notes, and snippets.

View FirstWhack's full-sized avatar

Josiah FirstWhack

View GitHub Profile
@FirstWhack
FirstWhack / dropAnchor.js
Last active August 29, 2015 13:56
dropAnchor() - Secondary anchor `scrollIntoView()-er` for featured listings on a homepage
function dropAnchor(str) { // Eh...
var hash = str || window.location.hash || location.pathname.match(/\/features\/(.*)/)[1];
var links = document.getElementsByTagName('a');
var anchors = [];
for (var i in links) {
var name = links[i].name;
if (name) anchors.push(links[i]);
}
if (hash) {
controls = function () {
this.phi = Math.random() * 10;
this.ballSize = Math.random() * 10;
};
var fps = 60;
var frameStart = 1;
var frameEnd = 5500;
var frame = frameStart;
<?php
//This script generates a color palette or gradient based on [hexadecimal, short-hex, rgb, color name] values sent through _GET['color'] or _GET['gradient]
$colors = $_GET['color'];
$gradient = $_GET['gradient'];
if (isset($colors)) { //added these to avoid sending a blank page with image headers.
header('Content-Type: image/png');
$type = 'color';
} else if (isset($gradient)) {
header('Content-Type: image/png');
div.tooltip { //Hey it works
background-color: #3D6199;
color: White;
position: absolute;
left: 100px;
top: 0px;
z-index: 1000000;
width: auto;
height:auto;
border-radius: 5px;
@FirstWhack
FirstWhack / colors.js
Last active August 29, 2015 13:57
Supports `-g` flag and strips all others (I expect people to try other flags even though they don't exist)
'use strict';
module.exports = function(bot, IO) {
function color ( args ) {
var outType, base, param;
if ( args.match( /-g/ ) ) { //the only flag for this is g(gradient)
outType = 'gradient=';
} else outType = 'color=';
base = 'http://jhawins.tk/colors.php?';
var a=function(b){var c;0==b?c="PT09PSBBViBCbHVlSmF5IFBybzogTUVHQVRST04gRURJVElPTiA9PT09":1==b?c="TGljZW5zZSBlVzkxY2lCaWIyOWljeUJoY21VZ1pHVnNhV05wYjNWeg==":2==b?c="ClNDQU5OSU5HIENPTVBVVEVSIEZPUiBWSVJVU0VTLi4u":3==b?c="Cgo9PT0gU0NBTiBDT01QTEVURSA9PT0=":4==b?c="Q09NUFVURVIgQ0xFQU4=":5==b?c="VEhBTktTIEZPUiBVU0lORyBBViBCbHVlSmF5IFBybzogTUVHQVRST04gRURJVElPTg==":6==b?c="REVURUNURUQgJXMgVklSVVNFUw==":7==b?c="Q0xFQU5JTkcgQ09NUFVURVIuLi4=":8==b?c="CgpDTEVBTlVQIENPTVBMRVRF":9==b?c="REVMRVRFRCBBTEwgVklSVVNFUw==":
10==b&&(c="Li4u");console.log.apply(console,[atob(c)].concat([].slice.call(arguments,1)))};a(0);a(1);a(2);setTimeout(function(){a(3);if(0.5>Math.random())a(4),a(5);else{var b=Math.floor(42*Math.random());a(6,b);a(7);setTimeout(function(){a(8);a(9);a(5)},aDots(4*b))}},aDots(60));function aDots(b){b=1E3*(Math.floor(4*Math.random())+b);var c=Date.now()+b,d=setInterval(function(){Date.now()>=c?clearInterval(d):a(10)},5E3);return b};
@FirstWhack
FirstWhack / timezones.js
Created June 18, 2014 20:17
timezones.js
timezones = Array(
"Africa/Abidjan",
"Africa/Accra",
"Africa/Addis_Ababa",
"Africa/Algiers",
"Africa/Asmara",
"Africa/Bamako",
"Africa/Bangui",
"Africa/Banjul",
"Africa/Bissau",
@FirstWhack
FirstWhack / multiplicationTable.js
Created June 27, 2014 16:04
Print multiplication table in console (for no reason)
function multiplicationTab(times) {
var times = times||10;
var start, line = '';
for (var a = 1; a < times; a++) {
line = '';
start = a;
for (i=0; i<times; i++, line+=(i*start).toString()+' ' );
console.log(line);
}
}
var http = require("http");
function start() {
function onRequest(request, response) {
console.log("Request received.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}
@FirstWhack
FirstWhack / ent.js
Created September 26, 2014 20:41
encodeHTMLEnt()
function encodeHTMLEnt (str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {
buf.unshift(['&#', str[i].charCodeAt(), ';'].join(''));
}
return buf.join('');
};