Skip to content

Instantly share code, notes, and snippets.

View jthomp's full-sized avatar
🏠
Working from home

Justin Thompson jthomp

🏠
Working from home
View GitHub Profile
@fernandoaleman
fernandoaleman / mysql2-m1.md
Last active April 22, 2024 23:15
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

Github to Discord Webhook Tutorial

In this tutorial I'll show you how to create a Github webhook that will post updates from your Github account to a channel in Discord. The steps are simple so follow along!

Create a Webhook in a Discord Channel

First you need to create a webhook in a text channel. We're assuming you have both Manage Channel and Manage Webhooks permissions!

  • Go in a channel properties (Alternatively, Server Settings, Webhooks works too)
@lisamelton
lisamelton / convert-mkv-to-mp4.sh
Last active October 17, 2021 13:51
Convert Matroska video file into MP4 format without transcoding.
#!/bin/bash
#
# convert-video.sh
#
# Copyright (c) 2013-2014 Don Melton
#
about() {
cat <<EOF
$program 2.0 of December 3, 2014
@mars
mars / register_chrome_with_window_size.rb
Created October 13, 2013 01:58
Set window size for Capybara/Selenium/chromedriver
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app,
browser: :chrome,
desired_capabilities: {
"chromeOptions" => {
"args" => %w{ window-size=1024,768 }
}
}
)
end
@tomas-stefano
tomas-stefano / Capybara.md
Last active May 2, 2024 05:16
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@paulsturgess
paulsturgess / attr_accessor_dates.md
Created May 2, 2013 08:11
How to set an attr_accessor date via Rails date_select and have Rails handle the multi-attributes automatically.

Your Class:

class YourClass < ActiveRecord::Base
  attr_accessor :some_date
  columns_hash["some_date"] = ActiveRecord::ConnectionAdapters::Column.new("some_date", nil, "date")
end

Your View:

<%= form_for :your_class do |f| %>

@felipecsl
felipecsl / restart coreaudio daemon
Last active April 24, 2024 18:39
Restart Mac OS X coreaudio daemon. Useful if you cannot change the audio output device to Airplay.
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
# or...
sudo killall coreaudiod
@priithaamer
priithaamer / gist:1034070
Created June 19, 2011 11:01
Capistrano task to ask confirmation before deploying to production
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
========================================================================
@rgo
rgo / capistrano_db_dump_and_clone_to_local.rb
Created March 1, 2010 12:04
Capistrano: Dump and clone to local database
# Directly copied from eycap-0.5.2 (thanks!)
#
# With these tasks you can:
# - dump your production database and save it in shared_path/db_backups
# - dump your production into your local database (clone_to_local)
#
# Tested and fixed by fjguzman
Capistrano::Configuration.instance(:must_exist).load do
namespace :db do