Skip to content

Instantly share code, notes, and snippets.

View towerofnix's full-sized avatar
🏳️‍⚧️
𝄞‍ — keeping busy's more fun in good company

(quasar) nebula towerofnix

🏳️‍⚧️
𝄞‍ — keeping busy's more fun in good company
View GitHub Profile
@towerofnix
towerofnix / detectplugins.js
Created July 13, 2015 14:41
Detect some plugins
var plugins = navigator.plugins;
var hasUnity = false;
var hasJavaApplet = false;
var hasFlash = false;
var hasSilverlight = false;
for (var i = 0; i < plugins.length; i++) {
//console.log("%c"+plugins[i].name+"%c "+plugins[i].description, "font-weight: 800", "font-weight: default");
if(plugins[i].name==="Unity Player") hasUnity = true;
if(plugins[i].name==="Java Applet Plug-in") hasJavaApplet = true;
if(plugins[i].name==="Shockwave Flash") hasFlash = true;
@towerofnix
towerofnix / loottables.java
Last active October 22, 2015 18:21
Tad bit of hacking around Minecraft led me to this
import com.google.common.base.Charsets;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.io.Files;
import com.google.common.io.Resources;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import java.io.File;
@towerofnix
towerofnix / syntacticsugar.js
Created November 5, 2015 23:49
Faking JavaScript syntactic sugar
/*\
| Faking JavaScript syntactic sugar
|
| Feel free to fork this to add more information!
|
| Remember to utilize ES6 things, because why not?
| It's standardized!
\_
| Contents:
|
@towerofnix
towerofnix / random-wikia-trivia.js
Last active August 2, 2020 23:15
Wikia trivia on anything! Just go to your favourite wiki and run this JavaScript code to get free trivia!
var what = "/Special:Random";
$.get(what).done(function(res) {
try {
res = (new DOMParser()).parseFromString(res, "text/html");
window.res = res;
what = res.querySelector("#WikiaPageHeader .header-title").textContent.trim();
// ==UserScript==
// @name Comment Sentiment
// @namespace http://joshuapullen.com/
// @version 0.1
// @description Colors comments based on whether they are mostly positive of negative
// @author Josh Pullen
// @match https://scratch.mit.edu/projects/*
// @match https://scratch.mit.edu/users/*
// @match http://scratch.mit.edu/projects/*
// @match http://scratch.mit.edu/users/*
[img]http://i.cubeupload.com/yeITn7.png[/img]
[url=http://liam4.github.io/programming-language-thing/codemirror/]Use it online[/url] [b]if on Firefox Nightly[/b] (or some other great ES6+ browser)
[url=https://github.com/liam4/programming-language-thing]Learn more[/url] about [big]P[/big]rogramming [big]L[/big]anguage [big]T[/big]hing!
Please give input :P
It's really, really in-development. Expect lots to change. :)
/* Notes: **READ ALL OF THESE**
Original source of the program is here:
https://scratch.mit.edu/discuss/post/1868091/
I've slightly modified the code (pretty-printed, renamed a couple variables,
etc. - don't forget to read these notes! - but the old code is still intact
here. If you're curious about what the original entirely non-modified code
was though don't hesitate to open that link. :P
@towerofnix
towerofnix / annotationdata.js
Last active March 27, 2016 20:51
don't increase limit in doTheThing over like 5 because youtube will probs ban your IP
var urls = {
proxy: (u) => `//crossorigin.me/${u}`,
proxy: (u) => u,
annotations: (id) => urls.proxy(`https://www.youtube.com/annotations_invideo?video_id=${id}`),
isYouTube: (u) => !!u.match('https://www.youtube.com/'),
getYouTubeID(u) {
var res = u.match(/\?v=([^$&]+)/);
return res ? res[1] : '';
}
};
@towerofnix
towerofnix / gems.md
Last active September 16, 2017 21:26
Particularly amazing gemstones in the virtual field of Scratch suggestions

Index: https://gist.github.com/towerofnix/ca9010add7d91bdbfd828ca829ee38e1

Particularly amazing gemstones in the virtual field of Scratch suggestions. Click on a link to get started! Each link brings you to a thread on the Scratch suggestion forums. These threads explain their suggestions better than most of the other suggestions on Scratch (of which half are duplicates!) so I figured I'd compile a list of the best suggestions here. I'm not saying I particularly like these suggestions but they generally are explained well and have pretty interesting suggestions. (At least, when not flooded by (no) "support"s!)

// str should be a great big binary string, e.g. '01101010'
// the string gets split into 8 bits of ascii codes, and then
// the characters are gotten from those
str = str.split('').filter(c => c === '0' || c === '1').join('')
new Array(str.length / 8)
.fill('')
.map((_,i) => str.slice(i*8,i*8+8))
.map((s) => String.fromCharCode(parseInt(s, 2)))