Skip to content

Instantly share code, notes, and snippets.

View MatthiasPortzel's full-sized avatar

Matthias MatthiasPortzel

View GitHub Profile
@MatthiasPortzel
MatthiasPortzel / EytukanTamperMonkey.js
Last active March 8, 2017 04:24
This program's bookmarklet, khanacademy.org/cs/i/6347724702416896, ported to TamperMonkey. Still quite buggy and doesn't always work.
// ==UserScript==
// @name Show flags on programs
// @version 1.1
// @description Shows number of flags for a program, even on the hot list (khanacademy.org/cs/i/6347724702416896)
// @author Eytukan (ported by Matthias)
// @match https://www.khanacademy.org/computing/computer-programming/browse
// @match https://www.khanacademy.org/profile/*/projects
// @grant none
// ==/UserScript==
@MatthiasPortzel
MatthiasPortzel / BetterKAVoting.js
Created September 8, 2017 01:43
A bookmarklet to improve voting on Khan Academy
(function () {
//The element that we mess with
var base = document.getElementsByClassName("voting-wrap")[0];
//No voting base means we're looking at a child account program or a tutorial/offical video
if (!base) {
//Try just adding a whole new thing
var wrap = document.getElementsByClassName("buttons_vponqv");
<!DOCTYPE html>
<!-- Taken from https://khanacademy.org/cs/i/5157014494511104, from pamela, from DillingerLee -->
<html>
<head>
<title>Processing.JS inside Webpages: Template</title>
</head>
<body>
<p align="center">
@MatthiasPortzel
MatthiasPortzel / KAUserList.json
Created January 12, 2018 04:49
A list of KA users and some basic info about them
[
{"username": "Butterflys4me", "kaid": "kaid_288875354292615286993893", "nickname": "Sasha B", "points": 5171599},
{"username": "JuzerShakir", "points": 5278769, "nickname": "Juzer Shakir", "kaid": "kaid_1019087183123970941813090"},
{"username": "furia.dhaval", "kaid": "kaid_1143531252016047271846752", "nickname": "Dhaval Furia", "points": 7861227},
{"username": "CaptainAmericaCivilWar2016", "kaid": "kaid_124058193188360295524990", "nickname": "David (TD)", "points": 0},
{"username": "kdgettelman", "points": 7063005, "nickname": "Lachesis", "kaid": "kaid_238644219424894610277990"},
{"username": "Thornclaw", "kaid": "kaid_449226918406096781851737", "nickname": "Roman Farchutdinov", "points": 6071563},
{"username": "versesvineyard", "kaid": "kaid_519084642615019393614658", "nickname": "jjv007", "points": 5924578},
{"username": "HeYamin", "points": 9742971, "nickname": "Benjamin", "kaid": "kaid_642616638457067013727525"},
{"username": "yagod", "points": 7122516, "nickname": "Yago", "kaid": "kaid_346165209013713
@MatthiasPortzel
MatthiasPortzel / better-ka-voting-v2.js
Created September 6, 2018 00:00
KA voting script, this time without down-voting, hopefully for the KA extension.
(function () {
/* ---- Definitions and fetching information ---- */
const EXTENSION_ITEM_CLASSNAME = "m-better-voting";
let oldWrap = document.querySelector(".voting-wrap .discussion-meta-controls").firstChild;
//No voting wrap means we're looking at a child account program or a tutorial/offical video or program, contest, etc
if (!oldWrap || !oldWrap.innerText.includes("Vote")) {
return;

Keybase proof

I hereby claim:

  • I am MatthiasSaihttam on github.
  • I am matthias1 (https://keybase.io/matthias1) on keybase.
  • I have a public key whose fingerprint is 7C97 9494 7C55 C478 FEFF 932C 154B 71C3 B6C7 7172

To claim this, I am signing this object:

function getAbnormalProps () {
var f = document.createElement("iframe");
f.src = "about:blank";
document.body.appendChild(f);
var normalProps = Object.keys(f.contentWindow);
var result = {};
Object.keys(window).filter(p => !normalProps.includes(p)).forEach(p => { result[p] = window[p]; });
@MatthiasPortzel
MatthiasPortzel / xi-syntax.md
Created April 13, 2019 04:36
An example of how to add syntax highlighting for new languages to xi-mac.
  1. To add, for example, TypeScript,
  2. Find a .sublime-syntax file for the language.
  3. Create a TypeScript folder in xi-mac/xi-editor/rust/syntect-plugin/syntect-resources/Packages/
  4. Place the .sublime-syntax file in that folder.
/xi-mac/xi-editor/rust/syntect-plugin/syntect-resources/Packages/TypeScript/TypeScript.sublime-syntax
  1. In xi-mac/xi-editor/rust/syntect-plugin/, run
import express from "express";
import Turn from "node-turn";
//App serves user controlled HTML inside of a content security policy
//The app can run JS but shouldn't be able to "phone-home" to a remote server
//This is untrusted
const CODE = `<!DOCTYPE html>
<html>
<body>