• Here is compiled a list of commands to run in postgres console:

    Run console

    $ docker-compose exec db psql -Upostgres to run pg console. In my case, I am running it from docker and the user is postgres, no password.

    List databases

    $ \l Will list available databases

    Switch database

    $ \c DATABASE_NAME allows you to switch between databases.

    Listing

    $ \d when connected to the database, list tables, views, and sequences.

    $ \dt list tables only.

    $ \d+ TABLE_NAME show description of the table:

    Show columns name:

    $ \t If queries show data but you don’t see table’s, this command will help to toggle that.

  • Here is compiled list of commands to list and delete images, containers and volumes.

    Images

    List:

    docker images -a
    docker images -f dangling=true
    

    Delete:

    docker rmi Image
    ### Remove dangling
    docker images purge
    ### Remove all
    docker rmi $(docker images -a -q)
    

    Containers

    List:

    docker ps -a
    ### List all exited containers
    docker ps -a -f status=exited
    

    Remove:

    docker rm ID_or_Name
    ### Remove all exited containers
    docker rm $(docker ps -a -f status=exited -q)
    ### Stop containers
    docker stop $(docker ps -a -q)
    

    Volumes

    List:

    ### All
    docker volume ls
    ### Dangling
    docker volume ls -f dangling=true
    

    Remove:

    docker volume rm volume_name
    ### Remove dangling
    docker volume prune
    ### Remove container and its volume at the same time
    docker rm -v container_name
    
  • I’ve tried to use Minitest for small ruby projects/exercises. Before that, I was always using rspec. But now I have some time and I wanted to try something new. Old “new”, hehe 😅. Minitest is straight forward, fast, what’s not to like. And it comes with Ruby by default since 1.9.

    Anyway, to my big surprise I couldn’t run all the tests from the directory, and playing one by one is time-consuming and tedious. If there is a default way how to run them all, please share, meanwhile here comes little Rakefile:

    require 'rake/testtask'
    
    desc 'Run specs'
    Rake::TestTask.new(:test) do |t|
      t.libs << 'lib'
      t.libs << 'test'
      t.pattern = './*_spec.rb'
      t.verbose = true
    end
    

    Now just run rake test and enjoy TDD.

  • I have a class and I have a test. And everything is great until I add next test…

    So, I had something like this:

  • Docker-compose up

    I have recently started to use docker for OwlDot and faced an issue that changes are not automaticaly picked up from Gemfile and bundle install isn’t run. To make it happen I needed to run docker-compose up --build , not just docker-compose up as usual. I need to build it 😅. Now it looks so obvious 😅

  • Happy Birthday RUBY!!!!!

    ruby logo
    Unbelievable, it turned 27 today!
    Congratulation to Ruby!
    Congratulation to us all!
    ruby matz twitter

  • This is copy from https://gist.github.com/ibraheem4 Thank you @ibraheem4

  • Here are couple examples of functions and arrow functions

    • Definition

      function setName(name) {
        this.name = name;
      }
      
      const setName = name => {
        this.name = name;
      };