add_column :table_name, :column_name, :decimal, default: 0, precision: 15, scale: 10
add_column :table_name, :column_name, :jsonb, default: {}, null: false
add_column :table_name, :column_name, :string, array: true, default: []
add_foreign_key :table_name, :table_name
add_foreign_key :table_name, :table_name, column: :column_name, name: :index_table_name_on_column_name
This file contains 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 'sidekiq/api' | |
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear |
This file contains 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
# frozen_string_literal: true | |
Rails.application.routes.draw do | |
if Rails.env.test? | |
namespace :test do | |
resource :session, only: :create | |
end | |
end | |
end |
This file contains 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
/** | |
* @name InfoBox | |
* @version 1.1.11 [January 9, 2012] | |
* @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google) | |
* @copyright Copyright 2010 Gary Little [gary at luxcentral.com] | |
* @fileoverview InfoBox extends the Google Maps JavaScript API V3 <tt>OverlayView</tt> class. | |
* <p> | |
* An InfoBox behaves like a <tt>google.maps.InfoWindow</tt>, but it supports several | |
* additional properties for advanced styling. An InfoBox can also be used as a map label. | |
* <p> |
This file contains 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
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib |
This file contains 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
sudo chown -R $USER ~/.gnupg | |
sudo chmod 700 ~/.gnupg | |
sudo chmod 600 ~/.gnupg/* |
This file contains 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
#!/bin/sh | |
set -e | |
# Firefox launcher containing a Profile migration helper for | |
# temporary profiles used during alpha and beta phases. | |
# Authors: | |
# Alexander Sack <asac@jwsdot.com> | |
# Fabien Tassin <fta@sofaraway.org> |
This file contains 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
#!/bin/bash | |
convert() { | |
file=$1 | |
target=${file//.sass/.scss} | |
paths_with_file=$(echo $file | tr '/' "\n" | wc -l | tr -d ' ') | |
paths_number=$(($paths_with_file - 4)) # app assets stylesheets ... filename.sass |
This file contains 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
gem install mysql2 -- --with-mysql-lib=$(brew --prefix)/Cellar/mysql/5.7.35/lib/ --with-mysql-dir=$(brew --prefix)/Cellar/mysql/5.7.35/ --with-mysql-config=$(brew --prefix)/Cellar/mysql/5.7.35/bin/mysql_config --with-mysql-include=$(brew --prefix)/Cellar/mysql/5.7.35/include/ |
This file contains 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 country_code_to_flag(country_code) | |
code = country_code.to_s.upcase | |
return unless code =~ /\A[A-Z]{2}\z/ | |
code.codepoints.map { |codepoint| (codepoint + 127_397).chr(Encoding::UTF_8) }.join | |
end | |
country_code_to_flag("BR") | |
# => "🇧🇷" |
NewerOlder