Skip to content

Instantly share code, notes, and snippets.

View almokhtarbr's full-sized avatar
👋

almokhtar almokhtarbr

👋
  • 18:59 (UTC -04:00)
View GitHub Profile
Apartment::TenantNotFound: One of the following schema(s) is invalid: "sdf-sdh" "demo-1", "shared_extensions"
/Users/almokhtar/Desktop/vroom/app/models/tenant.rb:41:in `switch_to'
/Users/almokhtar/Desktop/vroom/app/models/tenant.rb:77:in `block in with_each'
/Users/almokhtar/Desktop/vroom/app/models/tenant.rb:76:in `with_each'
/Users/almokhtar/Desktop/vroom/lib/tasks/quote.rake:6:in `block (2 levels) in <main>'
in rails console run
Apartment::Tenant.create('sdf-sdh')
require 'rake'
Rails.application.load_tasks # <-- MISSING LINE
Rake::Task['my_task'].invoke
set --universal fish_user_paths $fish_user_paths ~/.rbenv/shims/
brew install fish
# If you wish to make fish your default shell, add add /usr/local/bin/fish at the very top of /etc/shells, and execute chsh -s /usr/local/bin/fish. If not, then you can always type fish in bash.
# Oh My Fish
curl -L https://get.oh-my.fish | fish
omf install bobthefish
@almokhtarbr
almokhtarbr / ex
Created September 18, 2021 20:26
def palindrome?(str)
=begin
str.each_char.with_index do |char, i|
if str[i] != str[-i - 1]
return false
end
true
end
=end
reversed_str = ''
@almokhtarbr
almokhtarbr / pr
Last active September 20, 2021 14:16
git fetch origin pull/ID/head:BRANCHNAME
Replace the ID with the actual pull request id and BRANCHNAME with the branch name to which the pull request changes will be copied. Suppose the pull request id is 10 and the branch name we wish to create is demo-feature. Therefore, the command that we'll run
It's common knowledge in the *nix community, but for many new developers turning a Ruby script into an executable command line program is akin to magic. While there are other references on the internet, for the post here, I will briefly explain how to go from running a Ruby script by invoking Ruby directly, to running the script by its name alone.
We will start by assuming we have a simple Ruby script which prints "hello" on the command line. Our script's name will be greeter.rb. The file holds one line of Ruby code:
puts "Hello!"
To run the script, we must type ruby greeter.rb. Wouldn't it be nice to just type greeter instead and still get the script to run? Yes, it would.
First, we need to tell Bash what to do with our file since we won't be passing the script to Ruby directly. To do that, we add the following to the very top of our script:
#!/usr/bin/env ruby
# [<%= ENV["APP_NAME"] + "_default" %>, 1]
- [<%= "dev_default" %>, 6]
bundle exec shoryuken -R -C config/shoryuken.yml -v -L
application.rb
config.active_job.queue_adapter = :async
We couldn’t find that file to show.
@almokhtarbr
almokhtarbr / git
Last active August 23, 2021 18:00
# to reset all files after staging
git reset
# to stage all files
git add --all
# reset staged file
git reset HEAD <file>
git checkout <file>