Skip to content

Instantly share code, notes, and snippets.

@johnd0e
johnd0e / DEVNOTES.md
Last active April 12, 2026 10:37
LinkedIn Editor EOL Formatter

Developer Notes

This file documents the technical nuances, constraints, and decisions made during the development of the LinkedIn Editor Space Formatter userscript.

These notes are intended to understand why certain implementation choices were made — particularly where LinkedIn's internals are opaque and decisions were made out of caution rather than full certainty.


This is LinkedIn userscript automatically expands tiny textarea fields to fit their full content,
so you can see and edit your text without constant scrolling.
@johnd0e
johnd0e / IncSearch.moon
Last active August 24, 2025 19:26
[FAR macro] Incremental search in editor
"
.Language=Russian,Russian (Русский)
.PluginContents=IncSearch
.Options CtrlStartPosChar=^
@Contents
$ #Инкрементальный поиск#
Инкрементальный поиск — это поиск в редакторе без использования диалогового окна.
Введённый текст ищется сразу по мере его набора, и найденное индицируется выделением.
Кроме того подсвечиваются все вхождения искомой строки, и подсветка остаётся после
@johnd0e
johnd0e / fix_reverse_moonscript_lines.lua
Last active June 8, 2025 21:35
Fix MoonScript line numbers in error messages, for FAR Manager environment
--luacheck: globals lpeg debug.traceback_ ;new_globals debug.traceback
--luacheck: ignore 231/S
if select(2,...)>1 then return end --runonce
-- modified from https://github.com/leafo/moonscript/blob/master/moonscript/util.lua#L34
require"moonscript.util".pos_to_line = function(str, pos)
local line = 1
for _ in string.sub(str,1,pos):gmatch("\n") do
line = line + 1
end
@johnd0e
johnd0e / update_post.sh
Created February 4, 2025 00:28
Update phpBB 3 forum post, replacing it's content with specified file
#!/bin/bash
# Script Name: update_post.sh
# Author: John Doe
# Date: 2025-02-04
# Description: Update phpBB 3 forum post, replacing it's content with specified file
set -o errexit
set -o nounset
set -o pipefail
@johnd0e
johnd0e / hmac.lua
Created December 9, 2024 16:52
LuaJIT module: HMAC functions from OpenSSL (w/o LuaResty)
local ffi = require "ffi"
local ffi_new = ffi.new
local ffi_str = ffi.string
local ffi_gc = ffi.gc
local setmetatable = setmetatable
local _M = { _VERSION = '0.06' } --Source: https://github.com/jkeys089/lua-resty-hmac
local mt = { __index = _M }
@johnd0e
johnd0e / except.lua
Last active March 31, 2026 23:10
Exception control - lua implementation of ltn13 (from luasocket)
-- idea by Diego Nehab: https://github.com/lunarmodules/luasocket/blob/master/ltn013.md
-- improved by Peter Melnichenko: https://github.com/lunarmodules/luasocket/pull/161/files
-- https://github.com/mpeterv/luasocket/blob/e7b68bb49ce1a40effadda48969b9377e30887cb/src/except.lua
-- https://github.com/mpeterv/luasocket/blob/e7b68bb49ce1a40effadda48969b9377e30887cb/test/excepttest.lua
-- With some changes from John Doe:
-- - finalizer's call is unprotected, like in luasocket
-- - `except.try`, like in luasocket
-- - `except.newtry` demands a finalizer
-- - argument for finalizer can be specified
-- - on error `except.protect` returns the exact return values (instead of just `nil, arg[2]`)
@johnd0e
johnd0e / Descript.ion
Last active February 10, 2025 23:27
Far Manager Script: Lorem ipsum generator
zombies http://www.zombieipsum.com/
@johnd0e
johnd0e / venv.lua
Last active August 22, 2024 19:02
Far Manager utility for managing Python virtual environments
--https://forum.farmanager.com/viewtopic.php?p=176009#p176009
if print==mf.print then
print = mf.printconsole
end
local path = win.GetEnv("PATH")
local function activate (venv)
local dir = venv.."\\Scripts"
local exist = win.GetFileAttr(dir)
@johnd0e
johnd0e / Makefile
Last active August 22, 2024 20:40
Far Manager Script: Import environment
# https://github.com/FarManagerLegacy/HelpDown-scripts
# required user setting
BASE:=D:\repo\HelpDown-scripts
PANDOC:=C:\Apps\pandoc\pandoc.exe
HTMLTOFARHELP:=$(FARPROFILE)\tools\HtmlToFarHelp\HtmlToFarHelp.exe
# plug base Makefile
include $(BASE)\Makefile
.DEFAULT_GOAL:=hlf