# change mirror to ubuntu.osuosl.org first
sudo apt-get update
sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev
| t = 236 # seconds | |
| Time.at(t).utc.strftime("%H:%M:%S") | |
| => "00:03:56" | |
| # Reference | |
| # http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
| test the drinkboard menu route : | |
| sending a POST command with an id only | |
| curl http://drinkboard.herokuapp.com/app/menu.json -d 40 | |
| send a POST command with the remember token in the params | |
| curl http://localhost:3000/app/providers.json -d "token=vaRlsrT-JjQRkbAhtN27-w" | |
| example of multiple data route | |
| curl http://example.com/users -d"first_name=Bruce&last_name=Wayne" |
| class ApplicationController < ActionController::Base | |
| unless Rails.application.config.consider_all_requests_local | |
| #rescue_from Exception, with: :render_500 | |
| rescue_from ActionController::RoutingError, with: :render_canvas_404 | |
| rescue_from ActionController::UnknownController, with: :render_404 | |
| rescue_from AbstractController::ActionNotFound, with: :render_404 | |
| rescue_from ActiveRecord::RecordNotFound, with: :render_404 | |
| rescue_from ActiveResource::ForbiddenAccess, with: :render_403 | |
| end | |
| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to db/APP_NAME.dump" | |
| task :dump => :environment do | |
| cmd = nil | |
| with_config do |app, host, db, user| | |
| cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
| end | |
| puts cmd |
| # config/initializers/sidekiq.rb | |
| Sidekiq.configure_client do |config| # and repeat this inside a Sidekiq.configure_server | |
| config.redis = { | |
| master_name: 'your-master-name', | |
| sentinels: [ | |
| "sentinel://sentinel01.example.com:26379", | |
| "sentinel://sentinel02.example.com:26379", | |
| "sentinel://sentinel03.example.com:26379", | |
| ], | |
| failover_reconnect_timeout: 20, # roughly 3-5 seconds longer than the sentinel failover-timeout |
| 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 |
I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).
| #go to hb_hba.conf | |
| local all postgres ident | |
| #go to psql | |
| sudo -u postgres psql | |
| #enter the following command to set or change the password | |
| ALTER USER postgres PASSWORD 'actual_password'; | |
| #go to hb_hba.conf to change this line back |