Skip to content

Instantly share code, notes, and snippets.

View fervisa's full-sized avatar

Fernando Villalobos fervisa

  • Oaxaca, México
View GitHub Profile
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
require 'rubygems'
require 'rubygems/package'
require 'zlib'
require 'fileutils'
module Util
module Tar
# Creates a tar file in memory recursively
# from the given path.
#
@fervisa
fervisa / vim_short.md
Last active January 14, 2017 19:05 — forked from apux/1_vim_short.md
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -Sso ~/.vim/autoload/pathogen.vim \
    https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
set nocompatible
execute pathogen#infect()
syntax on
@fervisa
fervisa / redis-server
Last active August 29, 2015 14:07 — forked from cyx/gist:3690597
Monit configuration for Redis
check process redis-server
with pidfile "/var/run/redis.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if 2 restarts within 3 cycles then timeout
if totalmem > 100 Mb then alert
if children > 255 for 5 cycles then stop
if cpu usage > 95% for 3 cycles then restart
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
@fervisa
fervisa / hash_rocket.vim
Last active August 29, 2015 14:24 — forked from apux/vim_regex.md
:%s/:\(\w\+\) =>/\1:/g
@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 / .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
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