Skip to content

Instantly share code, notes, and snippets.

View smeans's full-sized avatar

Scott Means smeans

View GitHub Profile
@smeans
smeans / boxes.css
Created August 5, 2026 12:51
boxes.css - useful box layout styles for either CSS or custom elements
x-hbox, .x-hbox {
display: flex;
flex-direction: row;
align-items: center;
}
x-hbox.top, .x-hbox.top {
align-items: flex-start;
}
@smeans
smeans / boxes.css
Created December 18, 2025 16:57
Box Layout CSS Helpers
x-hbox, .x-hbox {
display: flex;
flex-direction: row;
align-items: center;
}
x-hbox.top, .x-hbox.top {
align-items: flex-start;
}
@smeans
smeans / retokenizer.py
Created December 16, 2025 14:53
Simple Python tokenizer
import re
r"""Creates a simple tokenizer using the Python re module.
Accepts a tokenizer 'spec' that is a dict of token types. Example:
svg_path_tokenizer = tokenizer({
'OP': {
"match": r'[a-zA-Z]+',
"type": str
},
'NUM': {
@smeans
smeans / node_visitor.gd
Created December 22, 2024 04:54
recursive node tree visitor iterator for Godot (gdscript)
@tool
extends EditorScript
class NodeVisitor:
var root: Node
func _init(nd: Node) -> void:
root = nd
func _iter_init(args: Array[Variant]) -> bool:
@smeans
smeans / camelize.js
Created December 11, 2024 16:48
cameliize
function camelize(s) {
const sa = s
.replace(/[^\w\d\s]/g, '')
.toLowerCase()
.split(/\s+/);
return sa
.filter(v => !!v)
.map((w, i) => (i > 0 ? w[0].toUpperCase() + w.substr(1) : w))
.join('');
@smeans
smeans / tocsv.py
Created November 5, 2024 17:44
tocsv.py
#!/usr/bin/env python3
import sys
import argparse
import glob
import re
import csv
import dateutil
def parse_args():
parser = argparse.ArgumentParser(
@smeans
smeans / FindConversionErrors.sql
Last active August 30, 2024 16:51
Find data conversion errors in MS SQL
ALTER PROCEDURE [dbo].[FindConversionErrorRow]
@sql nvarchar(max) null
AS
BEGIN
SET NOCOUNT ON;
if @sql is null
begin
print 'usage: Must add a row number to each row in the query that is erroring out:'
print ' select ROW_NUMBER() OVER(ORDER BY xxx) as rn, * fom BadView'
@smeans
smeans / DiffObjects.sql
Created April 17, 2024 04:02
MS SQL stored proc to diff two objects
CREATE OR ALTER PROCEDURE DiffObjects
@o1 nvarchar(max),
@o2 nvarchar(max)
AS
BEGIN
SET NOCOUNT ON;
if OBJECT_ID(@o1) is null
begin
select concat(@o1, ' does not exist') message
@smeans
smeans / boxes.css
Created February 27, 2024 02:22
CSS flex layout boxes
x-hbox, .x-hbox {
display: flex;
flex-direction: row;
align-items: center;
}
x-hbox.top, .x-hbox.top {
align-items: flex-start;
}
@smeans
smeans / traceif.py
Last active January 20, 2022 06:02
traceif: a Python decorator that conditionally logs function calls based on a lambda test expression.
# MIT License
#
# Copyright (c) 2022 Scott Means
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: