Skip to content

Instantly share code, notes, and snippets.

View vic's full-sized avatar
🐊
hoy amanecí dichosamente herido de muerte natural

Victor Borja vic

🐊
hoy amanecí dichosamente herido de muerte natural
View GitHub Profile
DROP FUNCTION IF EXISTS levenshtein;
DELIMITER $$
CREATE FUNCTION `levenshtein`( s1 text, s2 text) RETURNS int(11)
DETERMINISTIC
BEGIN
DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT;
DECLARE s1_char CHAR;
DECLARE cv0, cv1 text;
SET s1_len = CHAR_LENGTH(s1), s2_len = CHAR_LENGTH(s2), cv1 = 0x00, j = 1, i = 1, c = 0;
IF s1 = s2 THEN
@vic
vic / redy.js
Created November 5, 2008 18:43
/**
* Redy - a prototype for a ruby like javascript.
* Parts of this software are derived from JS.Class by James Coglan.
*
*
* This file is licensed under the Ruby licenense.
* Copyright 2008. Victor Hugo Borja <vic.borja gmail.com>
*/
Redy = {
@vic
vic / README.md
Last active July 1, 2025 21:35
fx-rs

Composable Effectful Computations in Rust: Integrating Algebraic Effects, Lenses, and Contextual Adaptation

fx-rs: An algebraic effects system for Rust.

Abstract

Effect systems have become a powerful tool for structuring modular, composable, and type-safe effectful computations. While algebraic effects and handlers have seen widespread adoption in languages like Haskell and OCaml, their integration in Rust remains limited. We present Fx, a novel effect system for Rust that unifies algebraic effects, lenses, and contextual adaptation in a single, extensible abstraction. Fx enables ergonomic composition of effectful computations, modular interpretation via handlers, and fine-grained state manipulation using lenses. We demonstrate how Fx supports advanced patterns such as context adaptation and effectful accumulation, and evaluate its expressiveness and ergonomics through practical examples. Our work shows that Rust’s type system and ownership model can support advance

@vic
vic / flake.nix
Last active February 26, 2025 04:37
example flake with overlays
{
outputs = inputs: {
overlays.foo = final: prev: {
foo = final.writeShellScriptBin "foo" "echo FOO";
};
overlays.moo = final: prev: {
moo = final.writeShellScriptBin "moo" "echo MOO";
};
};
@vic
vic / ytpls.sh
Last active November 27, 2024 11:26
Save a YouTube list as a playlist of videos.
#!/usr/bin/env bash
#
# ytpls.sh - Save a YouTube list as a playlist of videos.
#
#
# Doesnt actually download the videos, it just creates a playlist file `.pls` containing each video url.
# You can open such files with VLC or other media player on desktop and mobile.
#
#
# USAGE
@vic
vic / 2023-12-03.zig
Created December 5, 2023 18:57
AdventOfCode 2023 Day03 in Zig
const std = @import("std");
const Allocator = std.mem.Allocator;
const ConstantInput = *const []const u8;
const NumIdx = struct {
fromIdx: usize,
toIdx: usize,
pub fn text(self: NumIdx, input: ConstantInput) []const u8 {
@vic
vic / jitpack.yml
Created August 8, 2023 09:50
scala-cli gh-actions
before_install:
- curl -o scala-cli https://raw.githubusercontent.com/VirtusLab/scala-cli/main/scala-cli.sh
- chmod +x scala-cli
install:
- |
./scala-cli --power publish --publish-repository $HOME/.m2/repository --organization "$GROUP" --name "$ARTIFACT" --version "$VERSION" .
ls -R $HOME/.m2/repository/
find $HOME/.m2/repository -type f -name "*.pom" -exec cp -v {} $PWD \;
// ==UserScript==
// @name Gmail w/ Collapsible & Minimalist Inbox plus Google Calendar, Reader, Notebook, etc... Seamless Integration
// @namespace mail.google.com
// @include http://mail.google.com/*
// @include https://mail.google.com/*
// ==/UserScript==
var USER_CONFIGURATION =
{
ELEMENTS: //Place in order the pages you would like to load. Placing mail in the list will may it collapsible. Other choices are: reader, calendar, notebook or groups (must be lowercase.)
import mill._
trait BuildrModule extends Module {
def logger = {
val colors = interp.colors()
new mill.util.PrintLogger(
colors != ammonite.util.Colors.BlackWhite,
false,
colors.info(),
import com.raquo.airstream.flatten.FlattenStrategy
import com.raquo.laminar.api.L._
import com.raquo.laminar.nodes.ReactiveElement
import com.raquo.laminar.nodes.ReactiveHtmlElement
import scala.util.Failure
import scala.util.Success
import scala.util.Try
import org.scalajs.dom