Skip to content

Instantly share code, notes, and snippets.

View pfgithub's full-sized avatar
💭
Typing a status

pfg pfgithub

💭
Typing a status
View GitHub Profile
@pfgithub
pfgithub / app.js
Last active November 15, 2015 02:04
const wm = require('./api/windowman.js');
console.log(wm);
var window = new wm.Window("My window");
@pfgithub
pfgithub / solutions.js
Last active December 5, 2017 05:25
Advent of Code Solutions 2017
// 1
function getcaptcha(digits){
let count = 0;
digits.split("").forEach((digit, i,ds) => {
let nextDigit = ds[i+1] || ds[0];
if(digit == nextDigit) count += parseInt(digit, 10);
});
return count;
}
@pfgithub
pfgithub / get_belled_channels.js
Created December 16, 2017 23:08
Get all belled channels on youtube
// Visit https://www.youtube.com/subscription_manager
let vals = [];
Array.from(document.getElementsByClassName("yt-uix-subscription-notifications-all")).forEach((bellicon) => {
vals.push(bellicon.parentNode.parentNode.parentNode.childNodes[0].childNodes[0].childNodes[0].getAttribute("href").replace("/channel/", "")/*replace first instance*/);
});
vals
@pfgithub
pfgithub / commentbars.user.css
Last active June 23, 2018 01:01
Comment Bars
@-moz-document domain("tildes.net") {
.btn.btn-comment-collapse {
position: absolute;
transform: translate(-20px, -4px);
background-color: #eee;
border: none;
height: 100%;
transition: 0.1s background-color, 0.1s transform;
display: inline-flex;
text-align: right;
@pfgithub
pfgithub / pfgs goi mods.md
Created August 13, 2018 00:37
Mods for GOI

pfgs mods

You Are The Hammer:

PlayerControl Start() Bottom:

base.GetComponent<PolygonCollider2D>().isTrigger = true;
base.transform.Find("PotCollider").GetComponent().isTrigger = true;
@pfgithub
pfgithub / plistthing.js
Created October 16, 2018 01:32
simple plist thing
var bplistCreator, bplistParser, plist;
bplistParser = require('bplist-parser');
bplistCreator = require('bplist-creator');
plist = require('plist');
// reveal the underlying modules
exports.plist = plist;
@pfgithub
pfgithub / iroAceToMonarch.js
Last active May 16, 2019 00:19
Convert an ace syntax highlighter generated with iro to a monarch one
let ace = {/*your syntax highlighter here*/}
let tokens = {/*your syntax highlighter tokens and values*/}
console.log(JSON.stringify((() => {
let monarchTokenizer = {}
Object.keys(acerules).forEach(key => {
let value = acerules[key];
monarchTokenizer[key] = [];
let video = document.querySelector("video");
let frameTime = 0.01;
let timeElem = document.createElement("div");
let q = document.createTextNode("---");
timeElem.style.position = "fixed";
timeElem.style.top = "0";
timeElem.style.right = "0";
timeElem.style.padding = "10px";
timeElem.style.fontSize = "24pt";
timeElem.style.backgroundColor = "#fff";
@pfgithub
pfgithub / zig suggestions.md
Last active April 1, 2020 08:28
zig suggestions for the first day of the month

zig suggestions for the first day of the month

only one number type

zig is very confusing because it has so many number types. u16, i64, f32? what does all this mean‽ zig should follow the path of similar languages and simplify this down to one number type. I propose u0 because it can fill in for any other number type with a minimal loss of precision and takes less memory to store.

exceptions

instead of the confusing explicit error returns, zig should have untyped exceptions. that way, you have to be on edge every time you call a function and you have to worry if it might decide to error. it's especially nice because the errors shouldn't be mentioned in the docs. this makes programming more fun and exciting whenever you encounter a new error that you didn't know about.

@pfgithub
pfgithub / yy.js
Created August 8, 2020 07:47
ywot
{
function makeBoard(fill) {
// it would be useful if board could center at 0,0 and expand infinitely
let board = [];
let limits;
let reso = {
clear: () => {
board = [];
},