Skip to content

Instantly share code, notes, and snippets.

View th1agoalmeida's full-sized avatar
🏠
Working mostly from home since 2006

Thiago Almeida th1agoalmeida

🏠
Working mostly from home since 2006
View GitHub Profile
module Geocoder
module Lookup
class Base
private
def read_fixture(file)
File.read(File.join("spec", "fixtures", "geocoder", file)).strip.gsub(/\n\s*/, "")
end
end
class Google < Base
=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')
@th1agoalmeida
th1agoalmeida / urlbox.rb
Last active August 29, 2015 13:55 — forked from urlbox/urlbox.rb
# not necessary in Rails
require 'cgi'
require 'openssl'
require 'open-uri'
# OPTIONS :force, :full_page, :thumb_width, :width, :height
def urlbox(url, options={})
urlbox_apikey = 'xxx-xxx'
urlbox_secret = 'xxx-xxx'
belongs_to :gift
belongs_to :user
def consent
@user = current_user
if @user.update_attributes(params[:user])#this is really dangerous, I could force my email to change form the form =/
redirect_to :back, notice: "Error updating your user account"
else
flash[:notice] = 'User information updated'
@cart.consent_updated = false
end
end
if
@sentiment["mood"] == positive && @sentiment["prob"] > 0.94
@tag.score = 100
elsif
@sentiment["mood"] == positive && @sentiment["prob"] > 0.89
@tag.score = 96
elsif
@sentiment["mood"] == positive && @sentiment["prob"] > 0.84
@tag.score = 92
elsif