Skip to content

Instantly share code, notes, and snippets.

View lorenzosinisi's full-sized avatar
🦄
Elixir

Lorenzo Sinisi lorenzosinisi

🦄
Elixir
View GitHub Profile
# How to find out when and where a method is called in Rspec
puts "CALLED :#{caller_locations(1,1)[0].label} at #{caller_locations[1]}".red
@lorenzosinisi
lorenzosinisi / vimrc
Created May 10, 2016 13:51
vimrc file
set nocompatible " be iMproved, required
filetype off " required
autocmd ColorScheme * if g:colors_name == 'solarized' | hi link matlabComma Normal | else | hi link matlabComma SpecialKey | endif
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set expandtab
set tabstop=2
set shiftwidth=2
# source http://www.thegermanprofessor.com/top-500-german-words/
# they are really 429 and not 500 but a pretty good start
["und", "sein", "in", "an", "zu", "at", "haben", "ich", "werden", "sie", "her", "them",
"von", "nicht", "mit", "es", "sich", "auch", "auf", "für", "an", "so", "dass", "können", "dies",
"als", "when", "ihr", "her", "theirs", "ja", "wie", "bei", "oder", "wir", "aber", "dann", "man",
"da", "sein", "its", "noch", "nach", "was", "also", "aus", "all", "wenn", "nur", "müssen", "sagen",
"um", "machen", "kein", "du", "mein", "schon", "vor", "durch", "geben", "mehr", "anderes", "viel",
"kommen", "jetzt", "sollen", "mir", "wollen", "ganz", "all the", "mich", "immer", "gehen", "sehr",
"hier", "doch", "still", "bis", "groß", "wieder", "zwei", "gut", "wissen", "neu", "sehen", "lassen",
"have", "uns", "weil", "unter", "denn", "stehen", "jed", "die", "erstes", "ihm", "it", "ihn", "wo",
class RegistrationsController < Devise::RegistrationsController
before_action :check_captcha, only: [:create]
private
def check_captcha
binding.pry # it should stop here
unless verify_recaptcha
self.resource = resource_class.new sign_up_params
respond_with_navigational(resource) { render :new }
end
devise_for :coaches,
path: 'coaches',
path_names: {
sign_in: 'login',
sign_out: 'logout',
password: 'secret',
confirmation: 'verification',
unlock: 'unblock',
registration: 'register',
sign_up: 'new'
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Colorsublime - Themes/Solarized-dark.tmTheme",
"copy_with_empty_selection": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
"production",
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set expandtab
set tabstop=2
set shiftwidth=2
set splitright
set number
"""""""""""""""""""""""""""""""""""""
" Lorenzo Sinisi Vimrc configuration
"""""""""""""""""""""""""""""""""""""
set nocompatible
syntax on
set nowrap
set ignorecase
set smartcase
set encoding=utf8
set mouse=nicr
@lorenzosinisi
lorenzosinisi / .vimrc
Created December 19, 2017 09:26
Vimrc config for Elixir
"""""""""""""""""""""""""""""""""""""
" Lorenzo Sinisi Vimrc configuration
"""""""""""""""""""""""""""""""""""""
set nocompatible
syntax on
set nowrap
set ignorecase
set smartcase
set encoding=utf8
set mouse=nicr
@lorenzosinisi
lorenzosinisi / slaves.ex
Created January 17, 2018 19:45
Elixir Test Cluster with Slave Nodes
:ok = :net_kernel.monitor_nodes(true)
_ = :os.cmd('epmd -daemon')
{ok, master} = Node.start(:master@localhost, :shortnames)
setup_slaves = fn(limit) ->
Enum.each(1..limit, fn(index) ->
:slave.start_link(:localhost, 'slave_#{index}')
end)
[node() | Node.list()]
end