Skip to content

Instantly share code, notes, and snippets.

View RangerMauve's full-sized avatar
💜
Decentralizing

Mauve Signweaver RangerMauve

💜
Decentralizing
View GitHub Profile
@RangerMauve
RangerMauve / gist:6459971
Last active December 22, 2015 10:39
golf.js #6
s='*'
i=input
a=Array
j='join'
r=a(i+1)[j](s)
c=a(--i)
b='\n'+s+c[j](' ')+s
output=r+c[j](b)+(i?'\n'+r:'')
@RangerMauve
RangerMauve / gist:6459974
Created September 6, 2013 05:43
golfjs #3
function d(r){return(input.match(r)||[]).length}output=d(/[aeiou]/gi)+d(/y/gi)/2
@RangerMauve
RangerMauve / gist:6459981
Last active December 22, 2015 10:38
golfjs #5
i=input
output=i.split("").reverse().join("")==i
@RangerMauve
RangerMauve / gist:6493945
Last active December 22, 2015 15:39
Create a sphere of radius 1 from altitude and azimuth.
function makeVec(altitude,azimuth){
var x, y, z, hyp, vector;
z = Math.sin(altitude);
hyp = Math.cos(altitude);
y = hyp*Math.cos(azimuth);
x = hyp*Math.sin(azimuth);
vector = new Vector(x,y,z);
return vector;
}
@RangerMauve
RangerMauve / 1337_5P34K3R.js
Last active December 22, 2015 23:19
Leet Text Bookmarklet. To use, make a new bookmark and then copy paste the code into the URL field, when made just click the bookmark with a textbox selected.
javascript:void(
function(inp,el,mp,k){
el=document.activeElement||{};
inp=el.value||'';
mp={'is':/is/ig,'0':/o/ig,'1':/[il]/ig,'3':/e/ig,'4':/a/ig,'5':/s/ig,'7':/t/ig,'©':/c/ig,'Я':/r/ig,'м':/m/ig};
for(k in mp)inp=inp.replace(mp[k],k);
el.value=inp;
}());
@RangerMauve
RangerMauve / XKCD1288.user.js
Last active December 27, 2015 19:59
This is a filter I made that makes reading news more fun, I got the idea from http://xkcd.com/1288/. Since it's a userscript it should be easily install-able in Chrome or Firefox. In chrome it's as simple as downloading this file and dragging it into your "extensions" window.
// ==UserScript==
// @name FunNewsSubstitutions
// @namespace http://mauve.us.to
// @description This is a filter I made that makes reading news more fun, I got the idea from http://xkcd.com/1288/. Since it's a userscript it should be easily install-able in Chrome or Firefox
// @include *
// ==/UserScript==
// Wrapper to keep things in their own scope
(function(){
@RangerMauve
RangerMauve / R.js
Last active December 30, 2015 14:09
This is a neat idea I had for having variables that act like primitive values but are actually functions. Useful for having complex variables that automagically update.
// This calls the function whenever a primitive is needed
function R(fn){
return {
valueOf:fn,
toString:function(){
return fn()+"";
}
};
}
@RangerMauve
RangerMauve / CSS Quiz.html
Last active January 3, 2016 10:49
A simple quiz to help gauge the CSS ability of a potential designer.
<div class="A">
<div>
Hello, I like <span class="B">cats</span>.
</div>
<div>
I like <span class="B">dogs</span>.
</div>
<div>
I prefer <span class="B">reptiles</span>.
</div>
https?:\/\/.*\/(.*?).(jpe?g|gif|png)
@RangerMauve
RangerMauve / gist:3628bed7a25cd79a6394
Created January 19, 2015 22:26
Facade duplex streams
//https://www.npmjs.com/package/duplexer
var duplexer = require("duplexer");
var through = require("through2");
function boostrap(fn){
var input = noop(); // Just passes data through
var output = noop(); // Just passed data through;
input.once("data",function(chunk, encoding, cb){