Skip to content

Instantly share code, notes, and snippets.

@bbuchalter
bbuchalter / gist:ee5e8c964c4e67eaf81d9ba670155e2a
Created April 6, 2026 02:31
Plan for hedgedoc#4943 - Robots Meta Tag Support
# Robots Meta Tag Support
**Issues:** [#4943](https://github.com/hedgedoc/hedgedoc/issues/4943), [#4951](https://github.com/hedgedoc/hedgedoc/issues/4951)
**Goal:** Allow admins to set a server-wide default `robots` meta tag (e.g., `noindex, nofollow`) and allow per-note override via frontmatter. Render the tag server-side so crawlers see it.
## Current State
- The `robots` frontmatter field is already parsed in `commons/src/note-frontmatter/` and defaults to `''`
- The parsed value is never persisted to the database, returned via API, or rendered as a meta tag
@bbuchalter
bbuchalter / 2026-04-03-inline-comments-design.md
Last active April 4, 2026 00:32
HedgeDoc Inline Comments — Design Spec

HedgeDoc Inline Comments — Design Spec

Problem

HedgeDoc lacks a commenting feature. This is the most requested collaboration gap (issues #657, #2879, #5450) and a blocker for teams evaluating HedgeDoc as a Google Docs alternative. The community and maintainers have debated inline vs. out-of-band approaches for years without converging on a design.

Decision

Inline comments using CriticMarkup syntax, stored directly in the markdown document. A CodeMirror 6 extension hides the raw syntax and provides a clean UI. No backend changes required.

@bbuchalter
bbuchalter / case_test.rb
Last active May 25, 2022 11:31
Ruby can only parse 2498 case statement branches
case_statements = 10000
program = <<-RUBY
case(ARGV[1])
#{case_statements.times.map { |n| "when #{n+1} \n puts #{n+1}"}.join("\n")}
end
RUBY
File.write('test.rb', program)
puts "RUBY_VERSION=#{RUBY_VERSION}"
puts system('ruby test.rb')
@bbuchalter
bbuchalter / results.txt
Last active October 25, 2020 20:58
Are exceptions still slow in Ruby 2.7?
Warming up --------------------------------------
exception 74.658k i/100ms
break 588.320k i/100ms
return 551.993k i/100ms
Calculating -------------------------------------
exception 751.437k (±10.5%) i/s - 3.733M in 5.024957s
break 5.778M (± 1.2%) i/s - 29.416M in 5.091806s
return 5.444M (± 1.2%) i/s - 27.600M in 5.070550s
SET pagesize 30
set linesize 300
column "Tablespace" format a13
column "Used MB" format 99,999,999
column "Free MB" format 99,999,999
column "Total MB" format 99,999,999
column "Tablespace path" format a50
ttitle center 'Application tablespace' skip 2
SELECT fs.tablespace_name "Tablespace",
(df.totalspace - fs.freespace) "Used MB",
@bbuchalter
bbuchalter / where_is.rb
Created January 26, 2020 14:13 — forked from wtaysom/where_is.rb
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@bbuchalter
bbuchalter / README.md
Last active March 8, 2018 06:35
TILbot

TILbot

TILbot helps you reinforce what you learn. Get started by giving TILbot a question and answer, just like you were creating a flashcard. TILbot calls these TILcards. Congrats, this is your first act of learning reinforcement!

Your First TILcard

Let's say this is your first TILcard:

Question: What is the meaning of life, the universe and everything?

Answer: 42

@bbuchalter
bbuchalter / car.c
Created March 2, 2018 17:15
Infections, Hoare triples, and debugging by printouts
public class Car {
Seat[] seats;
//...
public int numEmptySeats() {
int count = 0;
int i;
// { count = 0 }
for(i = 0; i < this.seats.length; i++);
# Given a file containing order line items in the form [User ID]: [Medications] where medications are separated by commas, determine the pairs of medications that appear most frequently together.
# For example:
# Given two line items
# Zestril, atorvastatin, Levoxine
# Zestril, atorvastatin, Orasone
# The function should output the pair Zestril, atorvastatin.
# Create a calculator that takes integers separated by the basic mathematical operators (+,-,*,/) and returns the result.
# You can use Ruby's mathamatical methods(+, -, *, /).
# The priority is on working code, not brevity.
# 7 + 2 - 3 / 4 * 5 = 5.25
#math_characters = '7 + 2 - 3 / 4 * 5'
# magic