Skip to content

Instantly share code, notes, and snippets.

View biske's full-sized avatar

Ivan Bisevac (Иван Бишевац) biske

View GitHub Profile
[Desktop Entry]
Name=Aptana Studio 3
Comment=Integrated development environment (IDE) for building Ajax web applications.
Exec=/home/biske/Aptana_Studio_3/AptanaStudio3 -applciation
Icon=/home/biske/Aptana_Studio_3/icon.xpm
Terminal=false
Type=Application
StartupNotify=true
Categories=Development;RevisionControl;
X-GNOME-FullName=Aptana Studio 3
@biske
biske / google_robot.rb
Last active December 19, 2015 08:29
Google robot
require 'capybara/dsl'
require 'selenium-webdriver'
Capybara.run_server = false
Capybara.default_driver = :selenium
class GoogleRobot
include Capybara::DSL
def go
@biske
biske / living.rb
Last active December 23, 2015 01:59
if page.has_no_selctor?(:xpath, "//h1", text: "Missing Deal")
if page.has_selector?(:xpath, '//*[@id="deal_merchant_display_name"]')
sheet[red,0] = find(:xpath, '//*[@id="deal_merchant_display_name"]').text
end
if page.has_selector?(:xpath, '//*[@id="option_title_for_deal"]')
sheet[red,1] = find(:xpath, '//*[@id="option_title_for_deal"]').text
end
if page.has_selector?(:xpath, '//*[@id="view-details-full"]/p[2]')
sheet[red,2] = find(:xpath, '//*[@id="view-details-full"]/p[2]').text
end
@biske
biske / test.rb
Created September 30, 2013 10:45
require 'capybara/dsl'
require 'selenium-webdriver'
Capybara.run_server = false
Capybara.default_driver = :selenium
class Robot
include Capybara::DSL
def go
@biske
biske / test2.rb
Created September 30, 2013 10:47
require 'capybara/dsl'
require 'selenium-webdriver'
Capybara.run_server = false
Capybara.default_driver = :selenium
html_string = "<html>
<body>
<div id='foo'></div>
</body>
@biske
biske / template.rb
Last active December 24, 2015 12:09 — forked from jnicklas/template.rb
require "capybara"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app)
sess.visit("/")
puts sess.find('#id1').text
__END__
def open_user_file
print "File to open: "
filename = gets.chomp
fh = File.open filename
yield fh
fn.close
rescue
puts "Couldn't open your file!"
end
@biske
biske / elasticsearch_install.sh
Last active August 29, 2015 13:58
Install Elasticsearch on Ubuntu
Prerequisites
sudo apt-get install openjdk-7-jdk
Install
cd ~
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.0.deb
sudo dpkg -i elasticsearch-1.1.0.deb
class ControllerTestCase < ActionController::TestCase
include Devise::TestHelpers
include Warden::Test::Helpers
def setup
Warden.test_mode!
self.do_setup
end
curl -X POST --data 'user[email][email protected]&user[password]=pass' http://0.0.0.0:3000/users/sign_in