Skip to content

Instantly share code, notes, and snippets.

local wezterm = require("wezterm")
------------------------------------------------------------------------------------------------------------------------
-- Constants and helpers
------------------------------------------------------------------------------------------------------------------------
local FONT_FAMILY = wezterm.font("Spleen 32x64")
local FONT_SIZE = 16
local CHAR_SOLID_LEFT = wezterm.nerdfonts.pl_right_hard_divider
local COLOR_BACKGROUND = "#2e3440"
# SPDX-License-Identifier: GPL-2.0
#
# clang-format configuration file. Intended for clang-format >= 4.
#
# For more information, see:
#
# Documentation/process/clang-format.rst
# https://clang.llvm.org/docs/ClangFormat.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
function mc --wraps=mc
set -l f (mktemp)
if set -q f[1]
env SHELL=/bin/bash mc -P "$f" $argv
if test -r "$f"
set -l d (cat "$f")
if test -n "$d"; and test -d "$d"; and test "$d" != "$PWD"
builtin cd "$d"
require 'victor'
svg = Victor::SVG.new width: 140, height: 100, style: { background: '#ddd' }
svg.build do
rect x: 10, y: 10, width: 120, height: 80, rx: 10, fill: '#666'
circle cx: 50, cy: 50, r: 30, fill: 'yellow'
circle cx: 58, cy: 32, r: 4, fill: 'black'
polygon points: %w[45,50 80,30 80,70], fill: '#666'
#!/usr/bin/env ruby
# TOO UGLY!
#
# Offline MDN SVG: https://frankfurt.kapeli.com/feeds/zzz/mdn/SVG.tgz
ELEMENTS = %w[
a
animate
animateMotion
# frozen_string_literal: true
module Mahjong
module SVG
Dim = Data.define(:width, :height, :unit) do
def initialize(width:, height:, unit: "mm") = super(width: Float(width), height: Float(height), unit:)
def shortest = deconstruct.min
def longest = deconstruct.max
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@roktas
roktas / t.rb
Created October 19, 2022 23:11
require 'open-uri'
require 'json'
content = URI("https://fluxometer.com/rainbow/json/files.json").read
content.delete_prefix!("files(")
content.delete_suffix!(")")
data =JSON.parse(content)
puts data.first
# frozen_string_literal: true
module Checkmark
class Template
def self.[](modul, &block)
Class.new(self, &block).tap { _1.extend(Registerable[modul]) }
end
# attr_reader :type, :layout, :dir
@roktas
roktas / c.rb
Last active June 15, 2022 22:43
# frozen_string_literal: true
require 'delegate'
class Deck < DelegateClass(::Hash)
attr_reader :choosen
def initialize(choosen = nil, **initial)
super(initial)