Skip to content

Instantly share code, notes, and snippets.

<% require_relative File.expand_path("git_worktree", __dir__) %>
default: &default
adapter: postgresql
encoding: unicode
pool: 20
connect_timeout: 5
checkout_timeout: 5
development:
@zachdaniel
zachdaniel / .zshrc
Last active July 13, 2025 17:10
plz - Pipe into and out of claude code.
# get current cmd before executing
preexec() {
export PLZ_CURRENT_COMMAND="$1"
}
# so we can provide it to plz
plz() {
PLZ_FULL_CMD="$PLZ_CURRENT_COMMAND" $HOME/.dotfiles/scripts/plz "$@"
}
@ChristianAlexander
ChristianAlexander / detect.livemd
Last active July 8, 2025 02:06
Face Detection in Elixir

Face Detection in Elixir

Mix.install(
  [
    {:evision, "~> 0.1"},
    {:kino, "~> 0.7"}
  ],
@RStankov
RStankov / application_component.rb
Created April 25, 2024 11:56
ViewComponent Tips
class ApplicationComponent < ViewComponent::Base
private
def fetch_with_fallback(hash, key, fallback)
hash.fetch(key) do
ErrorReporting.capture_exception(%(key not found: "#{key}"))
fallback
end
end
@jpenalbae
jpenalbae / peek.sh
Last active October 9, 2024 19:45
Record desktop area on linux using slop and ffmpeg
#!/bin/bash
# Video Quality
# The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default,
# and 51 is worst quality possible. A lower value generally leads to higher
# quality, and a subjectively sane range is 17–28
QUALITY=28
# check if slop command exists
if ! command -v slop &> /dev/null
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active September 25, 2025 02:25
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Want more content like this, for free? Check out my free book, RailsAI!

Alt Text

@dhh
dhh / pagination_controller.js
Last active August 26, 2025 17:15
HEY's Stimulus Pagination Controller
/*
ERB template chunk from The Feed's display of emails:
<section class="postings postings--feed-style" id="postings"
data-controller="pagination" data-pagination-root-margin-value="40px">
<%= render partial: "postings/snippet", collection: @page.records, as: :posting, cached: true %>
<%= link_to(spinner_tag, url_for(page: @page.next_param),
class: "pagination-link", data: { pagination_target: "nextPageLink", preload: @page.first? }) unless @page.last? %>
</section>
class SynchronousJob < ApplicationJob
def self.perform_later
raise "This job is not designed to be run asynchronously. Please use #perform_now"
end
end

ServiceNow - Jelly scripting cheatsheet

UI Page consists of jelly, client script and processing script. UI Macro has the jelly script only (but client script can be injected in jelly script) Usages:

  • Open as a page using URI https://<instance_name>.service-now/<ui_page_name>.do
  • Open as a modal using client script (UI action, client script, etc) (see snippet 1)
// Snippet 1
var gm = new GlideModal('UI_dialog_name');
gm.setTitle('Show title');
@rob-murray
rob-murray / asdf_install_ruby_ssl.sh
Created April 14, 2020 20:14
ASDF - Install Ruby with SSL
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" asdf install ruby 2.6.5