Skip to content

Instantly share code, notes, and snippets.

View petrenkorf's full-sized avatar
🤔
Reflecting about contributions

Petris Rodrigo Fernandes petrenkorf

🤔
Reflecting about contributions
  • E-Core
  • Balneário Camboriú, SC, Brazil
View GitHub Profile
@markandrewj
markandrewj / gist:9270d311c3a14b3c3565
Last active August 17, 2022 04:30
How To Stub authentication in Devise controller specs

https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs

These are instructions for allowing you to use resource test doubles instead of actual ActiveRecord objects for testing controllers where Devise interactions are important. This means there's even less reliance on the database for controller specs, and that means faster tests!

This approach certainly needs some evolution, but it's a start.

To stub out your user for an action that expects an authenticated user, you'll want some code like this (once you've got Devise::TestHelpers loaded):

 user = double('user')
@coldclimate
coldclimate / Instructions
Created October 17, 2015 13:26
Installing Supervisord on Centos 66
Based on http://www.alphadevx.com/a/455-Installing-Supervisor-and-Superlance-on-CentOS
Vgrnt box used: https://github.com/tommy-muehle/puppet-vagrant-boxes/releases/download/1.0.0/centos-6.6-x86_64.box
sudo yum install python-setuptools
sudo easy_install supervisor
supervisord --version
echo_supervisord_conf | sudo tee /etc/supervisord.conf
sudo mkdir -p /etc/supervisord/conf.d/
sudo vi /etc/init.d/supervisord
@tomas-stefano
tomas-stefano / Capybara.md
Last active December 6, 2024 09:30
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@lsauer
lsauer / fuzzy-search.sql
Last active December 7, 2023 23:58
FullText fuzzy searching in SQL / MySQL
#lo sauer, 2013 - www.lsauer.com
#see: http://www.lsauer.com/2013/05/mysql-fuzzy-searching-fulltext-queries.html
#Note: In MySQL SUBSTRING, the string-index starts at position 1
SELECT * FROM tablename
WHERE SOUNDEX(tablename_field)
LIKE CONCAT('%',SUBSTRING(SOUNDEX('Fuzti serch derm'),2),'%');