Skip to content

Instantly share code, notes, and snippets.

View jeromedalbert's full-sized avatar
👨‍💻

Jerome Dalbert jeromedalbert

👨‍💻
View GitHub Profile
@jeromedalbert
jeromedalbert / .gitattributes
Last active March 3, 2024 12:18
Automatically resolve Git merge conflicts in Rails schema.rb by picking the most recent date in the conflict (now works with Rails 5 and recent versions of Git). The following files should be in your home ~ directory. Inspired by https://tbaggery.com/2010/10/24/reduce-your-rails-schema-conflicts.html
db/schema.rb merge=railsschema
@jeromedalbert
jeromedalbert / .streerc
Last active July 19, 2023 20:05
Ruby syntax_tree config
--print-width=100
--plugins=plugin/single_quotes,plugin/disable_ternary
--ignore-files='**/assets/**'
--ignore-files='db/*schema.rb'
--ignore-files='log/**'
--ignore-files='node_modules/**'
--ignore-files='package.json'
--ignore-files='public/**'
--ignore-files='tmp/**'
# Monkey patch to support an `enabled` option
module GraphQL
module FragmentCache
class << self
attr_accessor :enabled
end
self.enabled = true
class FieldExtension
module MonkeyPatch
@jeromedalbert
jeromedalbert / README.md
Created May 19, 2022 20:45 — forked from hopsoft/README.md
Smart Heroku Review Apps managed by GitHub Actions

Smart Heroku Review Apps managed by GitHub Actions

This gist aims to provide a simple solution for managing Heroku Review Apps with GitHub Actions due to the security incident that continues to disrupt Heroku's GitHub integration. Watch the demo to learn more.

Demo Video

.github
├── workflows
│   ├── heroku_review_app_create.yml
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@jeromedalbert
jeromedalbert / gist:7476f445b7538b488c6ec34b5c4f3da4
Created May 28, 2016 19:08
Installing the Docker Toolbox on OS X with brew
brew cask install dockertoolbox
docker-machine create --driver virtualbox default
docker-machine ls
eval $(docker-machine env default)
Put the exports in this eval in your .zshrc or .bashrc if you use bash
@jeromedalbert
jeromedalbert / setup.sh
Created February 10, 2021 06:26 — forked from r00k/setup.sh
#!/bin/sh
# Set up Rails app. Run this script immediately after cloning the codebase.
# Exit if any subcommand fails
set -e
# Copy over configs
if ! [ -f .env ]; then
cp .sample.env .env
module TmpSettings
module_function
def get(user:, setting:)
return nil if !user
$redis.get("tmp_settings:#{setting}:#{user.id}")
end
def set(user:, setting:, value:)
@jeromedalbert
jeromedalbert / Gemfile
Created January 4, 2021 23:49 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@jeromedalbert
jeromedalbert / .rubocop.yml
Created November 3, 2020 03:56
Custom Rubocop rule to prevent unless with multiple conditions
require:
- ./.rubocop_custom_cops.rb
AllCops:
# ...