Skip to content

Instantly share code, notes, and snippets.

View mgc-robot's full-sized avatar

Mark Gerald Cabatingan mgc-robot

View GitHub Profile
@mgc-robot
mgc-robot / authenticable.rb
Created June 5, 2018 06:05 — forked from esteedqueen/authenticable.rb
JSON API User Registration and Sessions with Devise
module Authenticable
# Devise methods overwrite
def current_user
@current_user ||= User.find_by(authentication_token: request.headers['Authorization'])
end
def authenticate_with_token!
render json: { errors: "Not authenticated" },
status: :unauthorized unless user_signed_in?
@mgc-robot
mgc-robot / gist:f00003933beb9b3e84f2a75fe56949d8
Created June 5, 2018 05:14 — forked from hpjaj/gist:ef5ba70a938a963332d0
RSpec - List of available Expectation Matchers - from Lynda.com course 'RSpec Testing Framework with Ruby'
## From Lynda.com course 'RSpec Testing Framework with Ruby'
describe 'Expectation Matchers' do
describe 'equivalence matchers' do
it 'will match loose equality with #eq' do
a = "2 cats"
b = "2 cats"
expect(a).to eq(b)
@mgc-robot
mgc-robot / 0_reuse_code.js
Created March 7, 2017 09:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console