Skip to content

Instantly share code, notes, and snippets.

Avatar
💜
Decentralizing

RangerMauve

💜
Decentralizing
View GitHub Profile
View gist:6459971
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:'')
View gist:6459974
function d(r){return(input.match(r)||[]).length}output=d(/[aeiou]/gi)+d(/y/gi)/2
View gist:6459981
i=input
output=i.split("").reverse().join("")==i
@RangerMauve
RangerMauve / gist:6493945
Last active Dec 22, 2015
Create a sphere of radius 1 from altitude and azimuth.
View gist:6493945
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 Dec 22, 2015
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.
View 1337_5P34K3R.js
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 Dec 27, 2015
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.
View XKCD1288.user.js
// ==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 Dec 30, 2015
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.
View R.js
// 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 Jan 3, 2016
A simple quiz to help gauge the CSS ability of a potential designer.
View CSS Quiz.html
<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>
View Image URL
https?:\/\/.*\/(.*?).(jpe?g|gif|png)
View gist:3628bed7a25cd79a6394
//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){