Skip to content

Instantly share code, notes, and snippets.

View orangeeli's full-sized avatar

Eliseu Martinho orangeeli

  • https://fooji.com
  • Lisbon
View GitHub Profile
@orangeeli
orangeeli / spec.api.gorillas.index.rb
Last active July 15, 2016 16:53
A spec example with Factory Girl
require 'rails_helper'
RSpec.describe 'GET /api/v1/gorilla' do
let(:gorilla) {FactoryGirl.create(:gorilla)}
before { get '/api/v1/gorilla'}
subject { response }
@orangeeli
orangeeli / spec.factories.gorilla.rb
Last active July 15, 2016 16:46
A factory girl factory example
FactoryGirl.define do
factory :gorilla do
first_name 'Björn'
middle_name { Faker::Name.name }
last_name { Faker::Name.last_name }
end
end
class GorillaController < JungleController
def share_banana
respond_to do |format|
format.json { render :json => banana_json }
end
end
def get_banana
respond_to do |format|
class JungleController < ActionController::Base
before_filter :is_there_a_hunter?
inherit_resources
protected
def is_there_a_hunter?
false
end
end
@orangeeli
orangeeli / git.tag.sh
Created June 21, 2016 06:46
git tagging play
#!/bin/bash
# https://git-scm.com/book/en/v2/Git-Basics-Tagging
# $1 => version
# $2 => comment
# example:
# git tag -a version -m "my tagged version"
git tag -a $1 -m "$2"
@orangeeli
orangeeli / dig.sh
Created June 24, 2016 14:02
To confirm that your DNS record is set up correctly, use the dig command with your custom domain. https://help.github.com/articles/setting-up-an-apex-domain/
#!/bin/bash
dig example.com +nostats +nocomments +nocmd