Skip to content

Instantly share code, notes, and snippets.

View fervisa's full-sized avatar

Fernando Villalobos fervisa

View GitHub Profile
require 'cgi'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base = Rails.application.secret_key_base)
config = Rails.application.config
cookie = CGI::unescape(cookie)
salt = config.action_dispatch.authenticated_encrypted_cookie_salt
encrypted_cookie_cipher = config.action_dispatch.encrypted_cookie_cipher || 'aes-256-gcm'
# serializer = ActiveSupport::MessageEncryptor::NullSerializer # use this line if you don't know your serializer
serializer = ActionDispatch::Cookies::JsonSerializer
:so $MYVIMRC
@fervisa
fervisa / .tmux.conf
Created January 19, 2017 16:34 — forked from lesm/.tmux.conf
Configuración personal de tmux
#soporte para 256 colores
set -g default-terminal "screen-256color"
#set -g default-terminal "xterm-256color"
#Cambiar PREFIX a Ctrl + a
set-option -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
#dividir la pantalla a la forma de vim
@fervisa
fervisa / accounts-react-rails-update-react-rails.diff
Created November 25, 2016 17:52
Update react-rails to version 1.9
diff --git a/Gemfile b/Gemfile
index aa730ff..cc68e2d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -16,7 +16,7 @@ gem 'coffee-rails', '~> 4.1.0'
gem 'bootstrap-sass', '~> 3.3.4'
-gem 'react-rails', '~> 1.0'
+gem 'react-rails', '~> 1.9'
@fervisa
fervisa / yank_into_buffer.vim
Created June 29, 2016 16:10
yank lines matching certain pattern into a buffer
:g/search_term/y A
@fervisa
fervisa / tmux-cheatsheet.markdown
Created June 24, 2016 20:03 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fervisa
fervisa / recognize_path.rb
Created February 1, 2016 20:02
Rails: Recognize route based on path
Rails.application.routes.recognize_path "/accounts/1"
@fervisa
fervisa / search_delete.vim
Last active December 15, 2015 00:00
VIM: Delete all lines matching the search term
:g/search_term/d
@fervisa
fervisa / bundle_install.sh
Created October 19, 2015 23:54
Navigates into every directory and install all required gems
for d in ./*/ ; do (cd "$d" && gem install bundler && bundle install); done
@fervisa
fervisa / column_type.rb
Created August 21, 2015 14:47
Get column type from an ActiveRecord model
@model.column_for_attribute('title').type