Skip to content

Instantly share code, notes, and snippets.

@osuushi
osuushi / bookmarklet.txt
Created February 27, 2014 23:07
OpenSpritz bookmarklet
javascript:void(function(){function spritzify(e,t,n){for(var i=6e4/n,l=e.split(" "),o=l.slice(0),r=0,a=0;a<l.length;a++)-1!=l[a].indexOf(".")&&(o[r]=l[a].replace(".","•")),(-1!=l[a].indexOf(",")||-1!=l[a].indexOf(":")||-1!=l[a].indexOf("-")||-1!=l[a].indexOf("(")||l[a].length>8)&&-1==l[a].indexOf(".")&&(o.splice(r+1,0,l[a]),o.splice(r+1,0,l[a]),r++,r++),(-1!=l[a].indexOf(".")||-1!=l[a].indexOf("!")||-1!=l[a].indexOf("?")||-1!=l[a].indexOf(":")||-1!=l[a].indexOf(";")||-1!=l[a].indexOf(")"))&&(o.splice(r+1,0,"."),o.splice(r+1,0,"."),o.splice(r+1,0,"."),r++,r++,r++),r++;l=o.slice(0);for(var a=0;a<l.length;a++)setTimeout(function(e){return function(){var n=pivot(l[e]);"undefined"!=typeof $?$(t).html(n):t.tagName?t.innerHTML=n:document.querySelector(t).innerHTML=n}}(a),i*a)}function pivot(e){var t=e.length;if(6>t){for(var n=1;e.length<22;)n>0?e+=".":e="."+e,n=-1*n;var i="",l="";t%2===0?(i=e.slice(0,e.length/2),l=e.slice(e.length/2,e.length)):(i=e.slice(0,e.length/2),l=e.slice(e.length/2,e.length));var o;o="<span c
@osuushi
osuushi / gist:2037421
Created March 14, 2012 15:52
return posix path to frontmost finder window
on getFinderDirectory()
tell application "Finder"
set loc to insertion location
return POSIX path of (loc as alias) as text
end tell
end getFinderDirectory
return getFinderDirectory()
@osuushi
osuushi / gist:2499913
Created April 26, 2012 14:19
Why globals named "p" are dangerous
p('This is a paragraph about some stuff').inject(document.body);
/* Lots of code later, but within the same scope */
for(var p in pancakeList) {
flip(p);
}
@osuushi
osuushi / pi.js
Last active December 14, 2015 03:38 — forked from peterc/pi.js
var points_total = 0;
var points_inside = 0;
var x, y, i;
while(true) {
for(i = 0; i < 10000; i++) {
x = Math.random();
y = Math.random();
points_inside += 2 + ~(x*x + y*y);
}
points_total += i;
@osuushi
osuushi / am_i_depressed.js
Created April 3, 2013 01:49
A script to tell you if you are depressed with "90% accuracy".
console.log("No.");
@osuushi
osuushi / rotate-youtube.tamper.js
Created May 15, 2021 20:13
Rotate YouTube videos Tampermonkey script
// ==UserScript==
// @name Rotate YouTube
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Key bindings to rotate youtube videos
// @author osuushi
// @match https://www.youtube.com/watch?*
// @icon https://www.google.com/s2/favicons?domain=youtube.com
// @grant GM_addStyle
// @require https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.5/mousetrap.min.js
p {
font-size:18px;
line-height:24px;
text-align: justify;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAbCAYAAAC5rTVJAAAA3ElEQVQY0wXBwU3CABQA0Oe3IVgarFpDwYNH41GvLuMYzuQ4boBKiqGBptbCoQHf8+b19C4/vb44RWElmTdWEyJXaUuqMZFaO1zykxCJ2nDBJoghoxnjeCv6lHqEYSaaKdsc+4WoMz5nN/QLsZ7wcXjkrxSrCdvjE10hqjG+zmlz8ZOgSehTsQkcS7pEON6yD4VBGGa0Y6Ve2C/YPptrhH7h+vvgTi38lR7USmuhK9zrZZZCm7uy1VkKfSrVoRa6xJmdQisKA1qjlCj1Er/SjJhrDCrNlLhTK+3UGf/2IVZs3eANJQAAAABJRU5ErkJggg==);
background-size:100% 72px;
-webkit-background-clip:text;
-webkit-text-fill-color:transparent
}
p {
font-size:24px;
line-height:32px;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAABgCAIAAAC46DQiAAAAYUlEQVQoz73SwQ3DIBAF0aetYDuAEtNJWoQKTAfOgcgS+M5pVnMafS0+X4JWHyAv4CbmdQDJICrthULfpYuckU52DshoUDd0KKuUZizc5zpJRlBpLxT6KtdFT3aO3H/wjx/oyySm/xnbdAAAAABJRU5ErkJggg==);
background-position-y:8px;
background-size:100% 128px;
-webkit-background-clip:text;
-webkit-text-fill-color:transparent
}