Skip to content

Instantly share code, notes, and snippets.

View theo-bittencourt's full-sized avatar

Theo B theo-bittencourt

  • IBJJF
  • Rio de Janeiro, Brazil
View GitHub Profile
/spec/integration/user_is_evaluated_spec.rb
require 'spec_helper'
describe 'User is evaluated', :wip do
let(:evaluator) { create(:user) }
let(:evaluated) { create(:user) }
let(:edition) { create(:edition, users: [evaluator, evaluated]) }
before do
@theo-bittencourt
theo-bittencourt / gist:7467150
Last active December 28, 2015 07:49
.Guarfile
begin
require 'guard/zeus'
guard :zeus do
watch(%r{^config/initializers/.+\.rb$})
watch(%r{^config/environments/.+\.rb$})
watch(%r{^Gemfile.lock$})
end
rescue LoadError
nil
end

Facebook Page Token – que não expira

O fluxo abaixo descreve como se deve obter um token (que não expira) para acesso à uma fanpage específica. Para tratar múltiplas fanpages de diferentes usuários, seria mais correto armazenar os tokens no db e criar um endpoint para tratar o callback de auth do FB.

O token gerado pode ser confirmado aqui: https://developers.facebook.com/tools/debug

  1. Criar um app e configurar 'Website with Facebook Login' para http://localhost:3000
@mixin selection($selectionColor, $selectionBackground, $selectionShadow: none) {
// defaults to text-shadow: none
::selection {
color: $selectionColor;
background: $selectionBackground;
text-shadow: $selectionShadow; }
::-moz-selection {
color: $selectionColor;
background: $selectionBackground;
text-shadow: $selectionShadow; }
# thor heroku:db:dump
# options: --keep = Keep dump file
# --remote staging = To change the name of the remote
# --user bob = To change the name of the user
module Heroku
class Db < Thor
method_option :keep, :type => :boolean, :default => false
method_option :remote, :type => :string, :default => "heroku"
method_option :host, :type => :string, :default => "localhost"
@theo-bittencourt
theo-bittencourt / gist:4217862
Created December 5, 2012 17:50
Date Time Format In RUBY
%a - The abbreviated weekday name (``Sun'')
%A - The full weekday name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The full month name (``January'')
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%j - Day of the year (001..366)
%m - Month of the year (01..12)
@theo-bittencourt
theo-bittencourt / gist:4005863
Created November 3, 2012 04:18
rake colecao verão
#encoding: utf-8
desc "cria produtos da coleção verão 2013 - viajantes"
task :create_products_viajantes => :environment do
@count = 0
@colecao = Colecao.where(:nome => "Viajantes").first
Produto.where(:colecao_id => @colecao.id).each do |p|
puts "Destruindo subprodutos de #{p.referencia}"
Subproduto.where(referencia: p.referencia).delete_all
@theo-bittencourt
theo-bittencourt / Active Admin Super Example of Resource Customization.rb
Created September 12, 2012 04:10
Active Admin: Super Example of Resource Customization
ActiveAdmin.register Event do
#Menu display index
menu :priority => 1
#Scopes
scope :all
scope :pending
scope :approved
scope :rejected
scope :cancelled