Open ~/.bash_profile in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {| sudo certbot --authenticator webroot --installer nginx | |
| select number | |
| add webroot (path/to/app) | |
| sudo service nginx restart |
| http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
| http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
| #payload: [{"kind"=>"person"}] | |
| Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
| #data: {"interest"=>["music", "movies", "programming"]} | |
| Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
| Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
| Segment.where("jsonb_array_length(data->'interest') > 1") |
| mkdir path/to/frontend | |
| mkdir path/to/backend | |
| add to /etc/nginx/sites-enabled/frontend | |
| server { | |
| location ~ /.well-known { | |
| allow all; | |
| default_type "text/plain"; | |
| root path/to/frontend; |
| <%= from_for(@your_instance) do |f| %> | |
| <%= button_to 'submit', '', { class: 'btn', onclick: "reCaptcha('your_action')" } %> | |
| <%= f.submit 'hide this btn', class: 'hidden', id: 'submit_this_form' %> | |
| <% end %> | |
| <script src="https://www.google.com/recaptcha/api.js?render=<%= ENV['RECAPTCHA_SITE_KEY'] %>"></script> | |
| <script> | |
| function reCaptcha(action) { | |
| event.preventDefault(); | |
| grecaptcha.ready(function () { |
| python -m SimpleHTTPServer 5000 | |
| # Thank you, Benjamin Oakes | |
| # http://www.benjaminoakes.com/2013/09/13/ruby-simple-http-server-minimalist-rake/ |
#Cucumber and Capybara - Behavior Driven Development
##Overview
Cucumber allows software developers to describe how software should behave in plain text. The text is written in a business-readable, domain-specific language. This allows non-programmers to write specific feature requests that can be turned into automated tests that drive development of the project.
Capybara is the largest rodent known to man.
| After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
| The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
| Database files have to be updated before starting the server, here are the steps that had to be followed: | |
| # need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
| brew unlink postgresql | |
| brew install [email protected] | |
| brew unlink [email protected] | |
| brew link postgresql |
| {"lastUpload":"2020-01-19T18:59:50.579Z","extensionVersion":"v3.4.3"} |
| require 'rails_helper' | |
| RSpec.describe TodosController, :type => :controller do | |
| describe "GET #index" do | |
| #describe "POST #create" do | |
| #describe "GET #show" do | |
| #describe "PATCH #update" do (or PUT #update) | |
| #describe "DELETE #destroy" do | |
| #describe "GET #new" do |