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
class CreateNodes < ActiveRecord::Migration[6.0] | |
def change | |
create_table :nodes do |t| | |
end | |
create_table :node_edges do |t| | |
t.integer :parent_id, null: false | |
t.integer :child_id, null: false | |
end | |
I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.
Here is what I had messed up, which you also probably did:
- I had too many different python interpreters
- Too many different symlinks which I lost track of
- almost no package I installed with pip worked without a headache
- any attempt to fix using online resources made it worse.
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
source "https://rubygems.org" | |
gem "roda" | |
gem "http", "~> 3.3" | |
gem "rest-client" | |
gem "httparty" |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
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 'benchmark' | |
require 'ostruct' | |
REP = 1000000 | |
User = Struct.new(:name, :age) | |
USER = "User".freeze | |
AGE = 21 | |
HASH = {:name => USER, :age => AGE}.freeze |
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
namespace :db do | |
desc "Backs up heroku database and restores it locally." | |
task import_from_heroku: [ :environment, :create ] do | |
HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote. | |
c = Rails.configuration.database_configuration[Rails.env] | |
heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil | |
Bundler.with_clean_env do | |
puts "[1/4] Capturing backup on Heroku" | |
`heroku pg:backups capture DATABASE_URL#{heroku_app_flag}` |
To remove a submodule you need to:
- Delete the relevant section from the .gitmodules file.
- Stage the .gitmodules changes git add .gitmodules
- Delete the relevant section from .git/config.
- Run git rm --cached path_to_submodule (no trailing slash).
- Run rm -rf .git/modules/path_to_submodule (no trailing slash).
- Commit git commit -m "Removed submodule "
- Delete the now untracked submodule files rm -rf path_to_submodule
NewerOlder