Skip to content

Instantly share code, notes, and snippets.

Daniel Serrano dnlserrano

Block or report user

Report or block dnlserrano

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dnlserrano / prepare-commit-msg
Created Jul 7, 2017
prepare-commit-msg git hook
View prepare-commit-msg
ticket=$(git symbolic-ref --short HEAD | sed 's/.*\/\([a-zA-Z]*\)-\([0-9]*\).*/JIRA \1-\2/g')
original_msg=$(cat $1)
echo "\n\n$ticket\n$original_msg" > $1
dnlserrano /
Created Aug 2, 2016 — forked from piscisaureus/
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

dnlserrano / api_controller.rb
Last active Feb 27, 2018
Custom Authentication Controllers
View api_controller.rb
class ApiController < ApplicationController
# define which model will act as token authenticatable
acts_as_token_authentication_handler_for Login
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
respond_to :json
skip_before_filter :verify_authenticity_token, if: :json_request?
dnlserrano / create.json.jbuilder
Last active Oct 18, 2017
Custom Token Authentication SessionController with DRY Authenticatable Logout
View create.json.jbuilder
json.success true do
json.auth_token @user.authentication_token
json.message "login successful"
dnlserrano / create.json.jbuilder
Last active Aug 29, 2015
Custom Token Authentication SessionsController
View create.json.jbuilder
json.success true do
json.auth_token @user.authentication_token
You can’t perform that action at this time.