Skip to content

Instantly share code, notes, and snippets.

View matiasleidemer's full-sized avatar

Matias H. Leidemer matiasleidemer

View GitHub Profile
@matiasleidemer
matiasleidemer / alias_matchers.md
Created January 8, 2019 19:15 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@matiasleidemer
matiasleidemer / paginate.rb
Last active January 8, 2018 14:34 — forked from be9/paginate.rb
kaminari + JSON API pagination helper
def paginate(scope, default_per_page = 20)
collection = scope.page(params[:page]).per((params[:per_page] || default_per_page).to_i)
current, total, per_page = collection.current_page, collection.total_pages, collection.limit_value
render json: [{
pagination: {
current: current,
previous: (current > 1 ? (current - 1) : nil),
next: (current == total ? nil : (current + 1)),
@matiasleidemer
matiasleidemer / set_pantheon_terminal_solarized
Created January 7, 2016 23:40 — forked from anonymous/set_pantheon_terminal_solarized
Sets Pantheon Terminal (Elementary OS) to Solarized Theme
#!/bin/bash
echo
echo "This script sets the pantheon terminal to the Solarized theme."
echo
until [[ $scheme -eq 1 ]] || [[ $scheme -eq 2 ]] || [[ $scheme -eq 3 ]]; do
echo "Choose one:"
echo "1) Light"
echo "2) Dark"