Skip to content

Instantly share code, notes, and snippets.

View denisdefreyne's full-sized avatar

Denis Defreyne denisdefreyne

View GitHub Profile
@denisdefreyne
denisdefreyne / html_proofer.rb
Created November 16, 2025 12:03
lib/checks/html_proofer.rb
Nanoc::Check.define(:html_proofer) do
res = `bundle exec htmlproofer --root-dir=output --disable-external --no-enforce-https --ignore-missing-alt --directory-index-files=index.html,index.php 2>&1`
if $?.exitstatus != 0
add_issue("html-proofer failed: #{res}")
end
end
@denisdefreyne
denisdefreyne / rc.zig
Last active November 6, 2025 10:05
A reference-counting implementation using an interface
const std = @import("std");
const Rc = @This();
ptr: *anyopaque,
ref_count_ptr: *u8,
deinit: *const fn (self: *const anyopaque) void,
pub fn refCount(self: *const Rc) u8 {
const std = @import("std");
const Self = @This();
ref_count: u8 = 1,
allocator: std.mem.Allocator,
content: union(enum) {
owned: struct {
data: []const u8,
},
function git_sync --description 'Brings all Git branches up to date'
set -l orig_branch (git rev-parse --abbrev-ref HEAD)
set -l repo_path (git rev-parse --show-toplevel)
set -l main_branch_name
if git show-ref --verify --quiet refs/heads/master
set main_branch_name master
else if git show-ref --verify --quiet refs/heads/main
set main_branch_name main
else
Hi denis,
sorry if this was annoying to answer your requests
1. the purposes of the processing: was to send a funny roast to thank dev who
contribute to open source (nanoc in your case) this is not for any commercial
purpose and we did not nor will store any email / data etc...
2. the categories of personal data concerned: email
@denisdefreyne
denisdefreyne / leftpad.py
Last active October 21, 2024 18:50 — forked from lf-/leftpad.py
leftpad.py with prime indents (2, 3, 5, 7)
class left_pad:
def __init__(this,PadChar=' ',width=4):
this.PadChar=PadChar
this.width = width
def LeftPad(this,stringToPadWithChar):
charsToPad=this.width-len(stringToPadWithChar)
OutStr=''
if(charsToPad>0):
for i in range(0,charsToPad):
OutStr=OutStr+this.PadChar
# UNTESTED
# In lib/ somewhere
Nanoc::Filter.new(:fetch_snapshot_textual) do |content, params|
item = @items[params.fetch(:item)]
rep = item.reps[params.fetch(:rep, :default)]
compiled_content = rep.compiled_content(snapshot: params.fetch(:snapshot))
compiled_content
end
/***********************************************************
* config
*/
:root {
--base-size: 0.3625rem;
--size-1: calc(1 * var(--base-size));
--size-2: calc(2 * var(--base-size));
--size-3: calc(4 * var(--base-size));
@denisdefreyne
denisdefreyne / gist:15091779e5ada3374e3c42c42b516a81
Created December 28, 2023 08:11
rdiscount-2.2.7.2/gem_make.out
current directory: /Users/denis/.rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/rdiscount-2.2.7.2/ext
/Users/denis/.rubies/ruby-3.3.0/bin/ruby extconf.rb
checking for random()... yes
checking for srandom()... yes
checking for rand()... yes
checking for srand()... yes
checking size of unsigned long... 8
checking size of unsigned int... 4
checking size of unsigned int... 4
checking size of unsigned short... 2
@denisdefreyne
denisdefreyne / term-bg-brightness.rb
Created November 10, 2022 12:06
Calculating terminal background color in Ruby
require 'io/console'
# Query RGB background color
raw = STDIN.raw do |stdin|
print "\e]11;?\a"
stdin.read(25)
end
# Parse
r, g, b = raw.scan(/[0-9a-f]{4}/).map { |part| part.to_i(16) / 65_535.0 }