Skip to content

Instantly share code, notes, and snippets.

AllCops:
Exclude:
- db/schema.rb
TargetRubyVersion: 2.5
Naming/AccessorMethodName:
Description: Check the naming of accessor methods for get_/set_.
Enabled: false
Naming/AsciiIdentifiers:
describe('Logging into Admin page test', function() {
it('Logs into Shopify Admin', function() {
cy.visit('https://shopify-store.myshopify.com/admin');
cy.get('#Login').type('LOGIN');
cy.get('#Password').type('PASSWORD {enter}');
});
});
@thrgamon
thrgamon / prepare-commit-message
Last active December 6, 2018 21:36
Takes the ticket prefix from the branch name and adds it to the commit message
#!/usr/bin/env ruby
BRANCHES_TO_SKIP = ['master', 'develop'].freeze
# Grabs 1-4 letters, a dash and 1-4 numbers after a leading slash.
# For example, with the string 'feature/DOT-38-update-gems' it would match 'DOT-38'
PREFIX_REGEX = /(?<=\/)[a-zA-Z]{1,4}-\d{1,4}/.freeze
message_file = ARGV[0]
branch_name = `git symbolic-ref --short HEAD`.strip
@thrgamon
thrgamon / prepare-commit-msg
Last active July 23, 2019 23:54
A Gist for extracting the Clubhouse Ticket Number from their suggested branch names
#!/usr/bin/env ruby
###
##
# A git hook to extract the ticket numnber from the Clubhouse branch helpers and prepend it to commit messages for git.
# The format of the branch name format is tomgamon/ch4120/some-branch-name.
# This would result in a commit message starting with [ch4120].
# If you want a quick way to set it up in a project, run this in the project root.
# curl -s https://gist.githubusercontent.com/thrgamon/76838290870145a33ded1ecffb432c59/raw > .git/hooks/prepare-commit-msg && chmod a+x .git/hooks/prepare-commit-msg
##
# A dumb script to scan your Rails schema file
# and detect indexes which may be unnecessary.
# Made with reckless abandon by Tom Gamon
# http://tomgamon.com
# ruby index_scan.rb db/schema/rb
schema = ARGF.read
creates_table = /create_table.*?end/ms
@thrgamon
thrgamon / pre-push
Created March 23, 2022 03:26
Lint with Standardrb pre-push hook
#!/bin/sh
Files=$(git diff --name-only --diff-filter=d `git merge-base origin/master HEAD` | grep -E "\.rb$" | grep -v "^db")
if [ ! -z "$Files" ]
then
bundle exec standardrb $Files
fi