This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git branch -r list all branch from the remote repo | |
# pipe the output to grep only branches start with 'automatic_translations' | |
# echo each branch_name stripping the prefix origin/ | |
# git push origin :{each_branch_name} | |
git branch -r | fgrep origin/automatic_translations | while read x; do echo "deleting ${x/origin\//}"; git push origin ":${x/origin\//}"; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add a new migration to the delayed_job table to track uniqueness | |
class AddSignatureToDelayedJobs < ActiveRecord::Migration[7.0] | |
def change | |
add_column :delayed_jobs, :signature, 'varchar(64)', index: true | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.3.1 | |
# Install dependencies | |
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs | |
# Set an environment variable where the Rails app is installed to inside of Docker image: | |
ENV RAILS_ROOT /var/www/app_name | |
RUN mkdir -p $RAILS_ROOT | |
# Set working directory, where the commands will be ran: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
describe 'Zeitwerk' do | |
it 'eager loads all files' do | |
expect { Zeitwerk::Loader.eager_load_all }.to_not raise_error | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails | |
alias "rce"="EDITOR=\"code --wait\" bin/rails credentials:edit" | |
alias "rapc"="bundle exec rails assets:clobber RAILS_ENV=production && bundle exec rails assets:precompile RAILS_ENV=production" | |
alias "rr"="bundle exec rspec" | |
alias "rs"="bundle exec rails s -b 0.0.0.0" | |
alias "rc"="bundle exec rails c" | |
alias "st"="spring stop" | |
alias "rcf"="st && rc" | |
alias "opengem"="gem open -e code" | |
alias "geminfo"="opengem" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### IDE Shortcut IntelliJ IDEA | |
``` cmd + shift + o ``` : Open file | |
``` cmd + d ``` : Duplicate line | |
``` cmd + ctrl + g ``` : Select multiple occurren | |
``` opt + shift + up/down ``` : Move item up and | |
``` opt + shift + click ``` : Multi select | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Disable XLIFF validation for all specs | |
config.before :all do | |
XliffUploader._before_callbacks.delete(:store) | |
end | |
#Enable XLIFF validation only for specs with ":enable_xliff_validation => true" | |
config.before :each, :enable_xliff_validation => true do | |
XliffUploader._before_callbacks[:store] = [:validate_xliff] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
paid_shops AS ( | |
SELECT DISTINCT ON(shopify_domain) shopify_domain,shop_plan, plans.name as plan_name, currency | |
FROM shops | |
INNER JOIN charges on shops.id = charges.shop_id | |
INNER JOIN plans ON charges.plan_id = plans.id | |
WHERE charges.processor = 'shopify' AND (commenced_at <= now()) | |
AND (cancelled_at IS NULL OR cancelled_at >= now()) | |
-- order by shopify_domain, charges.amount DESC | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.filter_by_job_status(job_status) | |
projects = where(nil) | |
if job_status == :completed | |
match_all = <<~EOD | |
EXISTS ( SELECT 1 FROM jobs WHERE jobs.project_id = projects.id ) AND | |
NOT EXISTS ( SELECT 1 from jobs WHERE jobs.project_id = projects.id AND jobs.status NOT IN (?) ) | |
EOD | |
return projects.where([match_all, job_status]) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_lb" "main" { | |
name = var.name | |
load_balancer_type = "application" | |
security_groups = var.security_group_ids | |
enable_deletion_protection = true | |
subnets = var.subnet_ids | |
internal = false | |
tags = var.default_tags | |
} |
NewerOlder