Skip to content

Instantly share code, notes, and snippets.

View Fishrock123's full-sized avatar
💭
#freepalestine #blacklivesmatter #acab drop ICE you cowards

Jeremiah Senkpiel Fishrock123

💭
#freepalestine #blacklivesmatter #acab drop ICE you cowards
View GitHub Profile
/**
* Overwrites default Mousetrap.bind method to optionally accept
* an object to bind multiple key events in a single call
*
* You can pass it in like:
*
* Mousetrap.bind({
* 'a': function() { console.log('a'); },
* 'b': function() { console.log('b'); }
* });
class Point
constructor: (@x = 0, @y = 0) ->
if isNaN(@x) or isNaN(@y)
throw new Error('Invalid coords')
add: (point) ->
@x += point.x
@y += point.y
subtract: (point) ->
@Fishrock123
Fishrock123 / convert.js
Last active December 16, 2015 04:09
Takes a numeric value 'x' and it's current scale as min / max, and converts it to a scale with a different min / max.
(function() {
function convertScale(x, min, max, min2, max2) {
var distance, percent;
distance = max - min;
percent = (x - min) / distance * 100;
percent = percent > 0 ? percent : -percent;
distance = max2 - min2;
return distance * percent / 100;
};
)();
@Fishrock123
Fishrock123 / jsblacklist.txt
Last active December 16, 2015 14:20
My JavaScript Blacklist.
vibrantmedia.com
tynt.com
intellitxt.com
snap.com
kontera.com
AdGardener.com
apture.com
wibiya.com
doubleclick.net
getconnected.southwestwi-fi.com
@Fishrock123
Fishrock123 / genrun.js
Last active December 18, 2015 05:38 — forked from jlongster/testgen.js
basic generator async lib fleshed out to be slightly nicer
// based off of https://gist.github.com/creationix/5544019
// these could probably be condensed more, but I'm just doing this
// quickly
exports = module.exports = run;
exports.call = call;
exports.invoke = invoke;
exports.bind = bind;
@Fishrock123
Fishrock123 / Content-Type-List.js
Last active December 23, 2015 10:59
All common Internet Media Types, in Javascript list form (for testing stuffs).
var content_types = [
'application/atom+xml',
'application/ecmascript',
'application/EDI-X12',
'application/EDIFACT',
'application/json',
'application/javascript',
'application/octet-stream',
'application/ogg',
'application/pdf',
@Fishrock123
Fishrock123 / alphainetabet.txt
Last active December 23, 2015 13:59
My internet alphabet (20 / 9 / 2013) - http://blog.audobox.com/your-internet-alphabet/
acko.net
biolitestove.com
cheezburger.com
dust514.com
expressjs.com
flickr.com
github.com
humblebundle.com
icloud.com
jquery.com
@Fishrock123
Fishrock123 / pixi.hextomatrix.js
Last active December 26, 2015 00:19
UNFINISHED. WIP. ETC. Code by "graphxdziner" on board.flashkit.com translated to js for use with pixi.js
/*
* @author "graphxdziner" on board.flashkit.com
* Source: http://board.flashkit.com/board/showthread.php?728847-convert-hex-value-to-colormatrix-array&s=a432383a54d4eeed74bf800b22ee0f83&p=3854541&viewfull=1#post3854541
*/
function setColor(mc, r, g, b, a)
{
var matrix =
[ r, 0, 0, 0
, 0, g, 0, 0
@Fishrock123
Fishrock123 / nav-highlight.js
Created November 8, 2013 23:17
My site's header highlighting code.
// Ignore the preceding '/'.
page = [removed].pathname.slice(1);
// The landing page corresponds to the 'home' icon.
if (page === '') page = 'home';
// Test if the page is a nav link.
page = page.match(/home|about|projects|blog/);
// Check the result of the regex.
if (page && page.length > 0) {
// Style the corresponding nav link.
$('#' + page[0]).children().addClass('current-page');
function Other(args) {
Original.call(this, args);
};
inherits(Other, Original);
// Yes, I know they are not actually "classes"
Other.prototype.classMethod = function() {
// called like so:
// var other = New Other()
// other.classMethod()