Skip to content

Instantly share code, notes, and snippets.

View fabianoleittes's full-sized avatar
🌍
Working from home

Fabiano Leite fabianoleittes

🌍
Working from home
View GitHub Profile
server {
listen 80;
server_name example.com;
rewrite ^/(.*) https://$server_name permanent;
}
server {
# Your application host will be used as a convention for directories and other stuffs
set $application_host "example.com";
# Rails application server timeout (we have to match the value here to not display Gateway Timeout error)
module ApplicationHelper
def tenant_name
tenant_configuration.tenant_name
end
def full_title(page_title)
base_title = "#{app_display_name} Dashboard"
if page_title.empty?
base_title
else
# require_relative "hget"
# client = FBPublic.new("penaltybr")
# client.data # returns the Graph API public data
# if you need see response details use:
# client.response # returns a Net::HTTPFound instance
# if you need an alias to get the api response use:
# fb_data = FBPublic.get_data("penaltybr") # returns the Graph API public data
@fabianoleittes
fabianoleittes / hack.sh
Created November 29, 2012 16:04 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@fabianoleittes
fabianoleittes / database_cleaner.rb
Created November 27, 2012 17:37 — forked from dnagir/database_cleaner.rb
Using transactional DB cleanup
# spec/support/database_cleaner.rb
require 'database_cleaner'
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with :truncation # Delete leftovers if any
DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
@fabianoleittes
fabianoleittes / gist:4080131
Created November 15, 2012 18:00 — forked from codenamev/gist_on_tumblr.js
Embed GitHub gist on your Tumblr
// REQUIRES:
// http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js
// http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js
// Based on: https://gist.github.com/1395926
$(document).ready(function() {
$('.gist').each(function(i) {
var file_separator = $(this).text().indexOf('#');
if (file_separator != -1) {
var gist_url = $(this).text().slice(0, file_separator);
var gist_file = $(this).text().slice(file_separator).replace("#file_", "?file=");
@fabianoleittes
fabianoleittes / uninstall_gems.sh
Created November 5, 2012 15:46 — forked from chumpy/uninstall_gems.sh
Uninstall all gems
#! /bin/bash
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
@fabianoleittes
fabianoleittes / capybara_cheat_sheet.md
Created November 5, 2012 15:44 — forked from chumpy/capybara_cheat_sheet.md
capybara cheat sheet

Capybara Cheat Sheet

Navigating

  visit('/projects')
  visit(post_comments_path(post))
@fabianoleittes
fabianoleittes / capybara cheat sheet
Created November 5, 2012 15:29 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@fabianoleittes
fabianoleittes / template.rb
Created October 25, 2012 16:47 — forked from caike/template.rb
Rails 3.2.6 template w/ Twitter Bootstrap
app_name = ARGV[0]
initial_resource_name = ask('What is your initial resource ?')
remove_file 'Gemfile'
create_file 'Gemfile', <<-eos
source 'https://rubygems.org'
gem 'rails', '3.2.6'