-
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
- Delete all untagged images
| sudo touch /etc/init.d/couchdb | |
| wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
| sudo dpkg -i erlang-solutions_1.0_all.deb | |
| sudo apt-get update | |
| sudo apt-get -y install elixir erlang-dev | |
| rm erlang-solutions_1.0_all.deb |
| sudo yum -y install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git | |
| sudo yum -y install wxBase.x86_64 | |
| sudo yum -y install wget | |
| wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm | |
| sudo rpm -Uvh erlang-solutions-1.0-1.noarch.rpm | |
| sudo yum -y install esl-erlang | |
| sudo mkdir /opt/elixir | |
| sudo git clone https://github.com/elixir-lang/elixir.git /opt/elixir | |
| cd /opt/elixir | |
| sudo make clean test |
| r := mux.NewRouter() | |
| // Single handler | |
| r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging) | |
| // All handlers | |
| http.Handle("/", recovery(r)) | |
| // Sub-routers | |
| apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json} |
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
| # download latest libevent2 and tmux sources, and extract them somewhere | |
| # | |
| # at the time of writing: | |
| # https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
| # http://sourceforge.net/projects/tmux/files/latest/download?source=files | |
| # | |
| # don't compile tools as root, just don't do it. | |
| # install deps |
| ActiveSupport::Inflector.inflections do |inflect| | |
| inflect.plural /([aeiou])([A-Z]|_|$)/, '\1s\2' | |
| inflect.plural /([rlnd])([A-Z]|_|$)/, '\1es\2' | |
| inflect.plural /([aeiou])([A-Z]|_|$)([a-z]+)([rlnd])($)/, '\1s\2\3\4es\5' | |
| inflect.plural /([rlnd])([A-Z]|_|$)([a-z]+)([aeiou])($)/, '\1es\2\3\4s\5' | |
| inflect.singular /([aeiou])s([A-Z]|_|$)/, '\1\2' | |
| inflect.singular /([rlnd])es([A-Z]|_|$)/, '\1\2' | |
| inflect.singular /([aeiou])s([A-Z]|_)([a-z]+)([rlnd])es($)/, '\1\2\3\4\5' | |
| inflect.singular /([rlnd])es([A-Z]|_)([a-z]+)([aeiou])s($)/, '\1\2\3\4\5' |
| require 'rubygems' | |
| require 'bcrypt' | |
| require 'haml' | |
| require 'sinatra' | |
| enable :sessions | |
| userTable = {} | |
| helpers do |
| ActiveSupport::Inflector.inflections do |inflect| | |
| inflect.plural /([aeiou])([A-Z]|_|$)/, '\1s\2' | |
| inflect.plural /([rlnd])([A-Z]|_|$)/, '\1es\2' | |
| inflect.plural /([aeiou])([A-Z]|_|$)([a-z]+)([rlnd])($)/, '\1s\2\3\4es\5' | |
| inflect.plural /([rlnd])([A-Z]|_|$)([a-z]+)([aeiou])($)/, '\1es\2\3\4s\5' | |
| inflect.singular /([aeiou])s([A-Z]|_|$)/, '\1\2' | |
| inflect.singular /([rlnd])es([A-Z]|_|$)/, '\1\2' | |
| inflect.singular /([aeiou])s([A-Z]|_)([a-z]+)([rlnd])es($)/, '\1\2\3\4\5' | |
| inflect.singular /([rlnd])es([A-Z]|_)([a-z]+)([aeiou])s($)/, '\1\2\3\4\5' |
Rails 3.1 gives us a really easy way to authenticate users in our app: http_basic_authenticate_with. Using it, all we need to do is create a model for the user (certainly, User model :P) with an attribute called password_digest and some views feature for login and register users. After all, let's relax and let Rails do the hard work.
gem 'bcrypt-ruby', '~> 3.0.0'
First at all, an User model which we can generate by following:
rails g model user email:string password_digest:string
and then add the following methodo call to generated class:
has_secure_password