Skip to content

Instantly share code, notes, and snippets.

View bigsnarfdude's full-sized avatar

BigsnarfDude bigsnarfdude

View GitHub Profile
@bigsnarfdude
bigsnarfdude / upgrade_recommendations_gemini.md
Created April 22, 2025 16:05
upgrade_recommendations_gemini.md

Codebase Overview

  • Technology: Ruby on Rails (likely v5/6), PostgreSQL, CoffeeScript, jQuery, SCSS, RSpec, Devise, Pundit, Administrate, Que/Sucker Punch, Griddler, Liquid templates, Webpacker[cite: 13, 14, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29].
  • Structure: Standard Rails MVC, utilizing service objects (app/services) [cite: 14] and model concerns (app/models/concerns) [cite: 13] for logic organization. Includes background jobs (app/jobs) [cite: 13] and Pundit policies (app/policies) [cite: 14] for authorization.
  • Key Features: Event/Membership management, Scheduling, Invitations/RSVP system, Email processing (incoming via Griddler, outgoing via multiple mailers), Admin dashboard, JSON API[cite: 13, 14, 16].
  • Legacy Integration: Contains code (LegacyConnector, SyncMembers, SyncPerson services) [cite: 14, 448, 453, 463, 464, 473, 474] suggesting integration with an older system, adding complexity.
  • Testing: Includes a substantial RSpec test suite (spec/)[cite:
@bigsnarfdude
bigsnarfdude / gist:7bdabbd2c6abc80e27cfb923a3890e45
Last active April 21, 2025 15:31
need to validate rails 5.2 to 6

ere's a checklist for testing the defaults in your new_framework_defaults_6_0.rb file:

  1. # Rails.application.config.action_view.default_enforce_utf8 = false

    • Purpose: Stops Rails from automatically adding accept-charset="UTF-8" to forms. This was mainly for older IE versions and is usually unnecessary now.
    • How to Test:
      • Enable it (remove the line or set to false).
      • Check your forms in various browsers, especially if you need to support very old ones. Ensure character encoding works as expected, particularly with non-ASCII characters submitted via forms.
  2. # Rails.application.config.action_dispatch.use_cookies_with_metadata = true

  • Purpose: Embeds purpose and expiry metadata into signed/encrypted cookies to prevent tampering (e.g., copying a cookie's value to another).
@bigsnarfdude
bigsnarfdude / workshops.md
Last active April 21, 2025 04:05
workshops.md

Ruby Upgrade Recommendations

Currently on Ruby 3.0:

  1. Ruby 3.1: Less dramatic changes than 3.0, but introduces pattern matching refinements and a new debugger.

  2. Ruby 3.2: Offers significant performance improvements with YJIT, better error messages, and syntax improvements.

Moving to 3.2 would be a good target as it has performance benefits without being too cutting edge.

You need to restore a PostgreSQL dump to your Docker container. Here's how to do it:
1. First, make sure you're working with the correct database container (`wsdb-upgrade`) which is running PostgreSQL 13.1
2. Use the `docker exec` command to pipe the dump file into the `psql` command inside the container:
```bash
cat workshops_staging.dump | docker exec -i wsdb-upgrade psql -U postgres -d workshops
```
@bigsnarfdude
bigsnarfdude / zipGit.sh
Created April 19, 2025 16:12
bash to zip git all files for checkins
# Define the oldest and newest commit hashes
OLDEST_COMMIT="e8264b948705ec4adefb9caa875c569753134516"
NEWEST_COMMIT="5b524772c15f9b7cff017bdb000db40709da28a4"
# Create a temporary directory to store the files
mkdir -p rails6_upgrade_files
# Get list of all changed files between these commits
git diff --name-only $OLDEST_COMMIT..$NEWEST_COMMIT > changed_files.txt
@bigsnarfdude
bigsnarfdude / image_segmentation_gemini_api.html
Created April 18, 2025 15:30
image_segmentation_gemini_api.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemini API Image Mask Visualization</title>
<script type="module">
import { GoogleGenerativeAI } from "https://esm.run/@google/generative-ai";
import { marked } from "https://esm.run/marked";
@bigsnarfdude
bigsnarfdude / image_segmentation.py
Created April 16, 2025 15:23
image_segmentation.py
# Copyright 2024 Big Vision Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@bigsnarfdude
bigsnarfdude / server_internal_flask.md
Created April 3, 2025 17:02
server_internal_flask.md

Running Flask on an Internal Network Interface

This guide explains how to configure a Flask application to run on a specific network interface on a macOS server with multiple NICs.

Prerequisites

  • macOS server with multiple network interfaces
  • Python installed
  • Flask installed (pip install flask)
@bigsnarfdude
bigsnarfdude / prune_worksops.py
Created March 31, 2025 14:53
prune_worksops.py
#!/usr/bin/env python3
import sys
import os
# --- Configuration ---
# Define prefixes of directory paths to exclude.
# Any file whose path starts with one of these prefixes will be removed.
# Add or remove prefixes as needed.
EXCLUDE_PREFIXES = (
@bigsnarfdude
bigsnarfdude / workshops.md
Last active March 30, 2025 13:17
workshops.md

How to get "Workshops" Rails application up and running on your local machine for development.

Goal: Set up a local development environment for the Workshops application using Docker.

1. Prerequisites:

  • Git: To clone the repository.
  • Docker: To build and run containerized applications. (Install Docker)
  • Docker Compose: To manage multi-container Docker applications. It's usually included with Docker Desktop.