Skip to content

Instantly share code, notes, and snippets.

View DRBragg's full-sized avatar

Drew Bragg DRBragg

View GitHub Profile
@fernandoaleman
fernandoaleman / mysql2-m1.md
Last active February 11, 2025 21:06
How to install mysql2 gem on m1 Mac

Problem

Installing mysql2 gem errors on Apple silicon M1, M2 or M3 Mac running macOS Sonoma.

Solution

Make sure mysql-client, openssl and zstd are installed on Mac via Homebrew.

Replace mysql-client with whichever mysql package you are using

@stevepolitodesign
stevepolitodesign / example.md
Last active October 31, 2021 16:03
Poor Man's Turbo with Remote Forms and Stimulus JS
import { Controller } from "@hotwired/stimulus"

// Connects to data-controller="form"
export default class extends Controller {
  static targets = [ "error" ]
  static values = { target: String,  action: String }

  connect() {
    this.target = this.hasTargetValue && document.querySelector(this.targetValue);
@MarkBennett
MarkBennett / installing-ruby-2.5.1-on-m1.md
Last active February 5, 2025 13:03
Installing Ruby 2.5 on Mac M1
# Have you ever wanted lldb to break in a certain place, but you weren't
# sure where to set the breakpoint? Look no further than this script!
#
# This script creates a chunk of executable code that uses the int3 x86
# instruction. This instruction is defined for use by debuggers, and you can
# read more about it here: https://en.wikipedia.org/wiki/INT_%28x86_instruction%29#INT3
#
# When that instruction is executed, the debugger will halt and you can do
# what you need!
#
@KonnorRogers
KonnorRogers / environment.js
Last active July 12, 2024 22:42
ESBuild with Webpacker < 6 in Rails. Bye Babel <3
// DONT FORGET TO `yarn add esbuild-loader` !!!
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
const { ESBuildPlugin } = require('esbuild-loader')
const esBuildUse = [
{
loader: require.resolve('esbuild-loader'),
// What you want to compile to, in this case, ES7
@leastbad
leastbad / action_mailbox.md
Last active April 8, 2025 20:26
Action Mailbox: The Missing Manual

This is all you really need to know in order to make Action Mailbox work in development.

  1. Fire up ngrok http 3000 and make note of your subdomain for steps 3 and 8.
  2. Create a Mailgun account because they offer sandbox addresses; grab your domain from the Dashboard.
  3. Go into Receiving and create a catch-all route pointing to: https://XXX.ngrok.io/rails/action_mailbox/mailgun/inbound_emails/mime
  4. Add your Mailgun API key to your credentials:
action_mailbox:
 mailgun_api_key: API KEY HERE
@castwide
castwide / rails.rb
Last active October 24, 2024 16:26
Enhance Rails Intellisense in Solargraph
# The following comments fill some of the gaps in Solargraph's understanding of
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
# ignored at runtime.
#
# You can put this file anywhere in the project, as long as it gets included in
# the workspace maps. It's recommended that you keep it in a standalone file
# instead of pasting it into an existing one.
#
# @!parse
# class ActionController::Base
@mrmartineau
mrmartineau / stimulus.md
Last active May 16, 2025 13:02
Stimulus cheatsheet
@januszm
januszm / change_eb_ruby_version.sh
Last active January 6, 2025 15:46
Change Ruby minor version in AWS Elastic Beanstalk
# Currently (2017/2018) it's not possible to change the Ruby 'minor' version (eg. 2.3 => 2.4) using the web console
# However, it's possible using the 'awscli' tool.
brew install awscli # pip install awscli
AWS_PROFILE=profile_from_credentials_file AWS_REGION=us-east-2 aws elasticbeanstalk update-environment \
--platform-arn "arn:aws:elasticbeanstalk:us-east-2::platform/Ruby 3.3 running on 64bit Amazon Linux 2023/4.3.0" \
--environment-name "myappenv1" --region us-east-2 \
--version-label "app-1234-210000_120123"
# older awscli using --solution-stack-name
@stevebauman
stevebauman / Editor.vue
Last active April 2, 2019 07:00
VueJS 2 + Trix Editor V-Model Component
<template>
<div></div>
</template>
<script>
import Trix from 'trix';
export default {
props: ['value'],