Skip to content

Instantly share code, notes, and snippets.

View ChaelCodes's full-sized avatar

Rachael Wright-Munn ChaelCodes

View GitHub Profile
@ChaelCodes
ChaelCodes / validate_me.rb
Created May 20, 2024 19:25
A Simple Example of Building a Custom Validator - for my talk "Validate Me!"
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails"
# If you want to test against edge Rails replace the previous line with this:
# gem "rails", github: "rails/rails", branch: "main"
@ChaelCodes
ChaelCodes / Gemfile
Created July 21, 2023 12:02
Troubleshooting gel install
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
ruby '2.7.8'
gem 'jekyll', '~> 4.2.0'
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem 'type-on-strap'
@ChaelCodes
ChaelCodes / AltText.md
Last active July 11, 2023 02:28
Stop using `git add .` - Image Alt text

Image 1 git status

On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   _config.yml

Changes not staged for commit:
$ git rebase -i origin/main
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.
$ git rebase -i --autostash origin/main
Created autostash: c4d543d
Applied autostash.
Successfully rebased and updated refs/heads/docker-test-improvements.
@ChaelCodes
ChaelCodes / build.log
Created October 10, 2022 17:58
Log from failing CASA build
Removing network casa_default
Network casa_default not found.
Removing volume casa_db_data
Volume casa_db_data not found.
###########################
BEGIN: docker-compose build
###########################
database uses an image, skipping
selenium_chrome uses an image, skipping
Building web
@ChaelCodes
ChaelCodes / currying.js
Last active September 8, 2021 22:35
When you curry a function, you can skip arguments when calling the function. Curry will wait until all arguments are present to attempt calling the function. This lets you define functions that supply an argument or two, and then call those functions with the rest of the arguments later.
// The function is curried, so we can skip a or b
const add = curry((a, b) => a + b);
// These functions use a curried function, so you can skip an argument
const increment = add(1);
const addTen = add(10);
// The function is now called because the second argument is supplied
addTen(5); // returns 15
increment(3); // returns 4
# ZggkdvW9k9kkLFCl3g0
print "what's 5x5?"
print "25"
# PulgaMechanica
print "Hi Chael, what u up to?"
ptiny "LI am celebtaying my 2nd streamiversary! Folks may remember when I reviewed the Kinesis on stream, and I did a blindfolded Q&A while I was learning touch-tuping!"
# JonSugar
print "chael, is Ruby dead?"
class Game
attr_gtk
def tick
defaults
render
input
calc
end
@ChaelCodes
ChaelCodes / rails_41986.rb
Created April 25, 2021 16:19
Rails #41986 Reproduction
# frozen_string_literal: true
# In a many-to-many relationship, when setting values using
# ids, and nested_attributes, if the attributes come first,
# they are overriden by the ids. If the ids come first, the
# attributes are included too!
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
body {
background-color: rgba(255, 0, 0, 100);
}