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 'fileutils' | |
# Loop through all .jpg and .png files in the current directory | |
Dir.glob("{*.jpg,*.png}").each do |img| | |
# Construct the output filename with .webp extension | |
output_filename = "#{File.basename(img, File.extname(img))}.webp" | |
# Execute ffmpeg command to convert the image | |
system("ffmpeg -i '#{img}' '#{output_filename}'") | |
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
module CrudConcern | |
extend ActiveSupport::Concern | |
# Rails version < 5 | |
################################################################## | |
# This module take cares the CRUD controller methods # | |
# # | |
# Note: add skip_before_action if you want to ignore any of the # | |
# above action to be loaded from module # | |
################################################################## |
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
class BaseClient | |
class APINotFound < StandardError; end | |
attr_reader :auth_strategy | |
def initialize(auth_strategy: :headers, headers: {}) | |
@auth_strategy = auth_strategy | |
@headers = headers | |
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
# https://stackoverflow.com/questions/24397640/rails-nested-includes-on-active-records | |
# I believe the following should work for you. | |
Event.includes(users: :profile) | |
# If you want to include an association (we'll call it C) of an already included association (we'll call it B), you'd use the syntax above. However, if you'd like to include D as well, which is also an association of B, that's when you'd use the array as given in the example in the Rails Guide. | |
A.includes(bees: [:cees, :dees]) | |
# You could continue to nest includes like that (if you actually need to). Say that A is also associated with Z, and that C is associated to E and F. |
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
# Make sure to configure this script! | |
# 1. Change `TEAM_LINEAR` properties below to match your Linear team | |
# 2. Optionally add more teams | |
# 3. Change the value of `DEPLOYED_TO_STAGING_GIT_TAG` to the tag/branch you use for deploys to staging | |
# 4. Change the value of `DEPLOYED_TO_PRODUCTION_GIT_TAG` to the tag/branch you use for deploys to production | |
# | |
# Usage: | |
# LINEAR_API_KEY=... GITHUB_API_KEY=... ruby move_deployed_linear_issues.rb | |
# | |
# Adding new teams (change "LinearTeam" to your team name): |
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
heroku pg:info -a your_app |
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
######################################################################################################### | |
# I18n French translation for Devise (http://github.com/plataformatec/devise) | |
# I18n traduction française pour Devise | |
######################################################################################################### | |
fr: | |
errors: | |
messages: | |
not_found: "n'a pas été trouvé(e)" | |
already_confirmed: "a déjà été confirmé(e)" |
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 select_date(date, options = {}) | |
field = options[:from] | |
base_id = find(:xpath, ".//label[contains(.,'#{field}')]")[:for] | |
year, month, day = date.split(',') | |
select year, :from => "#{base_id}_1i" | |
select month, :from => "#{base_id}_2i" | |
select day, :from => "#{base_id}_3i" | |
end | |
def select_time(hour, minute, options = {}) |