Skip to content

Instantly share code, notes, and snippets.

View andrebras's full-sized avatar

André Brás andrebras

View GitHub Profile
@andrebras
andrebras / deploy.rb
Created January 11, 2012 16:29
Capistrano deploy.rb example (capistrano+passenger+rvm+bundler+git)
set :application, "sprai"
# RVM integration
# http://beginrescueend.com/integration/capistrano/
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, "1.9.2-p290"
set :rvm_type, :user
# Bundler integration (bundle install)
@andrebras
andrebras / some_index!
Created January 26, 2012 18:10
HAML index example
.form_holder
%h3.button#label_new_project Novo Projeto
%div{class: "form_fields", id: "new_project", style: "display:none"}
- @project = Project.new
= render partial: 'form'
:javascript
$('.button#label_new_project').click(function(e) {
e.preventDefault();
$('.form_fields').toggle('slow');
@andrebras
andrebras / simple form example with HAML
Created January 26, 2012 18:20
HAML and simple_form
%h1= content_for :title, DocumentRequest.model_name.human
.fieldset
= simple_form_for @document_request, :validation => true do |f|
= f.input :ExternalDocument
= f.input :project_code, disabled: true
= f.input :company_name, disabled: true
= f.input :comercial_entity_name, disabled: true
= f.input :Requested, as: :boolean
= f.input :Performed, as: :boolean
@andrebras
andrebras / application
Created January 26, 2012 18:55
So you can compare....
<!DOCTYPE html>
<html>
<head>
<title><%= content_for?(:title) ? yield(:title) : "Sprai" %></title>
<%= stylesheet_link_tag "style", media: 'screen, projection' %>
<%= stylesheet_link_tag "print", media: 'print' %>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
<%= yield(:head) %>
@andrebras
andrebras / application
Created January 26, 2012 18:57
So you can compare
%head
%title= content_for?(:title) ? yield(:title) : "Sprai"
= stylesheet_link_tag 'screen.css', media: 'screen, projection'
= stylesheet_link_tag 'print.css', media: 'print'
/ = stylesheet_link_tag '1140.css'
= stylesheet_link_tag 'application.css'
/[if IE]
= stylesheet_link_tag 'ie.css', :media => 'screen, projection'
= javascript_include_tag :defaults
= csrf_meta_tag
class Automation::RulePatternFactory < Ruleby::Rulebook
include Ruleby
def patterns_from rules = []
@rules = rules
build_rules
end
protected
@andrebras
andrebras / linked_list_sample.rb
Last active May 25, 2016 13:43
Linked List Sample
# Joana: sample of a linked list in ruby, this was a first attempt and should (must :) be refactored!
class Node
attr_accessor :data, :next_node
def initialize(data, next_node = nil)
@data = data
@next_node = next_node
end
end

Keybase proof

I hereby claim:

  • I am andrebras on github.
  • I am andrebras (https://keybase.io/andrebras) on keybase.
  • I have a public key whose fingerprint is 26C1 EB40 4751 181F A21D 84A3 5EE2 86D2 E7CF A32A

To claim this, I am signing this object:

@andrebras
andrebras / keybase.md
Last active April 6, 2021 21:21 — forked from webframp/keybase.md
Signing git commits on github using keybase.io gpg key

Setup Keybase (& import key)

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key