Skip to content

Instantly share code, notes, and snippets.

View MatthiasPortzel's full-sized avatar

Matthias MatthiasPortzel

View GitHub Profile
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>

Making git diff and less work together nicely on Mac

For reference, some Less options we're going to be using:

  • -S, less doesn't wrap lines;
  • -F, less auto-exits if output less than a page
  • -R, less honors color control codes
  • -X, disables termcap. This is set by git by default, but it breaks scrolling for some reason
  1. Make sure you're using the most recent version of both software. (The versions that are compiled by Apple and included in macOS are non-standard.)
% Prolog doesn't have functions, per se. It has statements that are true.
% For example, addition(2, 2, 4) can be read as "two plus two is 4".
% And it doesn't return anything.
% It can sometimes be helpful to think of the third value as a return value,
% however, the power of Prolog is that the statements can be read both "forward" and "backward"
% Prolog is like a deduction machine.
% Given a list of facts, it will deduce the values of any variables (things that start with capital letters)
const std = @import("std");
// -- Proposed microzig code -- //
const Pin = struct {
number: usize,
fn toggle(self: Pin) void {
std.debug.print("toggling pin {}\n", .{ self.number });
}
@MatthiasPortzel
MatthiasPortzel / working_package_manager.rb
Last active May 31, 2025 14:53
A Sublime Text Package management script
#!/usr/bin/env ruby
# Some dependencies are not available on PiPy (like mdpopups, sublime_lib, and lsp_utils).
# These can be installed by supporting a custom dependency format that is compatible with Package Control's,
# but right now I have code for that commented-out and I'm trying to upstream a `pyproject.toml` file for these dependencies,
# which allows them to be installed by pip with a `git+` URL.
# # Package control uses naming from https://github.com/packagecontrol/channel/blob/main/repository.json
# AVAILABLE_DEP_PACKAGES = {
# # TODO: These should really be installed in Lib/ not Packages/
# # TODO: We need the subpath to be at the top level. It makes things less elegant but I think we need to support it