Skip to content

Instantly share code, notes, and snippets.

View thiagofm's full-sized avatar
🐢
Slowly coming back to OSS

Thiago Massa thiagofm

🐢
Slowly coming back to OSS
View GitHub Profile
def fibo(n)
if(n==0)
return 0
elsif (n==1)
return 1
else
return fibo(n-1) + fibo(n-2)
end
end
@thiagofm
thiagofm / QuadradoMagico.java
Created May 1, 2011 22:19
Verifica se uma matriz é um quadrado mágico
import java.util.Scanner;
public class QuadradoMagico {
public static void main(String[] args){
Scanner e = new Scanner (System.in);
int i, j;
int matriz[][]= new int [3][3];
/*
for (i =0;i<3;i++){
public class ProcuraOcorrencia {
public static void main(String[] args){
String s1 = "carrocaacaca";
String s2 = "ca";
int ocorrencias = 0;
for(int i=0;i<s1.length();i++){
if(s1.charAt(i)==s2.charAt(0)){
for(int j=0; j<s2.length();j++){
if(s1.charAt(i)!=s2.charAt(j)){
break;
______________________________________
( In the first place, God made idiots; )
( this was for practice; then he made )
( school boards. )
( )
( -- Mark Twain )
--------------------------------------
o
o \_\_ _/_/
o \__/
@thiagofm
thiagofm / gist:2150801
Created March 21, 2012 18:27
scriptzor.rb
#!/usr/bin/env ruby
require 'net/ssh'
module TestingMethods
def create_test #uses the current authorized_keys
Net::SSH.start(@server, 'root') do |ssh|
ssh.exec "cat ~/.ssh/authorized_keys >> #{@ak_path}"
end
end
@thiagofm
thiagofm / capybara cheat sheet
Created March 26, 2012 19:10 — forked from cmilfont/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')
Dominios .com.br em processo de liberação (http://registro.br/dominio/proclib.html)
1 abati
2 abatia
3 abunda
4 acampe
5 acerte
6 acidez
7 adaga
8 adense
# antes:
<!--MENU-->
<nav class="menu">
<ul>
<li>
<% if params[:action].eql? 'sobre' %>
<%= link_to 'Sobre', help_sobre_url, :class => 'on' %>
<% else %>
<%= link_to 'Sobre', help_sobre_url %>
@thiagofm
thiagofm / calculate_price_steps.rb
Created September 13, 2012 14:17
calculate_price_steps.rb
Given /^I'm on the landing page$/ do
visit '/'
end
When /^I select my plan, source, destination and time$/ do
#@options = { :plan => '120', :source => '018', :destination => '011', :time => '200' }
fill_in 'tempo', :with => '200'
select '120', :from => 'plano'
select '018', :from => 'origem'
select '011', :from => 'destino'
@thiagofm
thiagofm / PriceCalculator_spec.rb
Created September 13, 2012 14:28
PriceCalculator_spec.rb
require 'spec_helper'
describe FaleMais::PriceCalculator do
context "#object" do
it "should be a subclass of Object" do
Object.constants.should include(:FaleMais)
end
it "should be instantiable" do
FaleMais::PriceCalculator.new.should be_an_instance_of FaleMais::PriceCalculator