Skip to content

Instantly share code, notes, and snippets.

@remon
remon / yardoc_cheatsheet.md
Created July 22, 2022 13:43 — forked from chetan/yardoc_cheatsheet.md
YARD cheatsheet
@remon
remon / Rakefile
Created May 17, 2021 14:15 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@remon
remon / sidekiq.config
Created March 7, 2021 15:36 — forked from maxdbn/sidekiq.config
Gracefully restarting Sidekiq on Elasticbeanstalk, only after it's done with the running jobs. Tested on: 64bit Amazon Linux 2016.09 v2.3.0 running Ruby 2.3 (Puma). Thanks to ssaunier for the original gist! https://gist.github.com/ssaunier/44bbebb9c0fa01953860
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@remon
remon / project-web-reload.conf
Created August 12, 2019 13:26 — forked from potatosalad/project-web-reload.conf
Upstart + Bluepill + Unicorn with hot restart
# /etc/init/project-web-reload.conf
pre-start script
initctl restart project-web
sleep 15
end script
exec /usr/local/rvm/bin/default_bluepill restart
@remon
remon / monit_aplicacion
Created August 10, 2019 15:23 — forked from thotmx/monit_aplicacion
Monit: Restart unicorn automatically
check process unicorn-<<aplicacion>>
with pidfile /home/deployer/apps/<<aplicacion>>/current/tmp/pids/unicorn.pid
start program = "/etc/init.d/unicorn_blog start"
stop program = "/etc/init.d/unicorn_blog stop"
restart program = "/etc/init.d/unicorn_blog stop && /etc/init.d/unicorn_blog start"
group unicorn-blog
check file blog-restart with path /home/deployer/apps/<<aplicacion>>/current/tmp/restart.txt
if changed timestamp
then exec "/usr/bin/monit -g unicorn-blog restart"
@remon
remon / subdomain-localhost-rails-5.md
Created June 20, 2019 11:50 — forked from indiesquidge/subdomain-localhost-rails-5.md
how to access subdomains locally with Rails 5

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do
@remon
remon / GitCommitEmoji.md
Created June 6, 2019 00:29 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
# A list of replacement words to be passed in to the play game function.
parts_of_speech1 = ["PLACE", "PERSON", "PLURALNOUN", "NOUN", "NAME", "VERB", "OCCUPATION", "ADJECTIVE"]
# The following are some test strings to pass in to the play_game function.
test_string1 = "Hi, my name is NAME and I really like to VERB PLURALNOUN. I'm also a OCCUPATION at PLACE."
test_string2 = """PERSON! What is PERSON going to do with all these ADJECTIVE PLURALNOUN? Only a registered
OCCUPATION could VERB them."""
test_string3 = "What a ADJECTIVE day! I can VERB the day off from being a OCCUPATION and go VERB at PLACE."
# Checks if a word in parts_of_speech is a substring of the word passed in.
def helloFriends():
return "Hello All Coders"
print(helloFriends())