Perl-inspired notation to quote strings: by using % (percent character) and specifying a delimiting character.
Any single non-alpha-numeric character can be used as the delimiter, %[including these]
, %?or these?
, %~or even these things~
.
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
######################### | |
# config/initializers/doorkeeper.rb | |
######################### | |
Doorkeeper.configure do | |
# Change the ORM that doorkeeper will use. | |
# Currently supported options are :active_record, :mongoid2, :mongoid3, :mongo_mapper | |
orm :active_record | |
# This block will be called to check whether the resource owner is authenticated or not. |
# lib/omniauth/facebook.rb | |
require 'httparty' | |
module Omniauth | |
class Facebook | |
include HTTParty | |
# The base uri for facebook graph API | |
base_uri 'https://graph.facebook.com/v2.3' |
[client] | |
port = 3306 | |
socket = /var/run/mysqld/mysqld.sock | |
# This was formally known as [safe_mysqld]. Both versions are currently parsed. | |
[mysqld_safe] | |
socket = /var/run/mysqld/mysqld.sock | |
nice = 0 | |
syslog |
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do
Picking the right architecture = Picking the right battles + Managing trade-offs
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.
SessionsHelper
store_location
(usage)redirect_back_or
(usage)