- Method instantiation and method calls need parans () (ie. bus.drive(), new Bus())
- Minimize dom selectors in classes (pass in dom elements into class constructor)
class Bus
constructor: ->
class Bus
# Sample verbose configuration file for Unicorn (not Rack) | |
# | |
# This configuration file documents many features of Unicorn | |
# that may not be needed for some applications. See | |
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb | |
# for a much simpler configuration file. | |
# | |
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete | |
# documentation. | |
application = ENV['APP_NAME'] |
before_script: | |
- psql -c 'CREATE USER the_user WITH CREATEDB;' -U postgres | |
- psql -c 'CREATE database the_db_test;' -U postgres | |
- psql -c 'ALTER DATABASE the_db_test OWNER TO the_user' -U postgres |
=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') |
God.watch do |w| | |
w.name = 'remote_syslog' | |
w.interval = 7.seconds | |
w.log = File.join(RAILS_ROOT, 'log', "#{w.name}-god.log") | |
w.dir = RAILS_ROOT | |
w.start = "bundle exec remote_syslog --tls -D -c #{RAILS_ROOT}/config/remote_syslog.yml" |
Copyright (C) 2012 Nathan Youngman | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
of the Software, and to permit persons to whom the Software is furnished to do | |
so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all |
require 'open-uri' | |
require 'nokogiri' | |
def google_results(keyword) | |
begin | |
results = [] | |
doc = Nokogiri::HTML(open("https://www.google.com/search?q=#{keyword}")) | |
doc.xpath("//h3//a[@href]").each do |href| |
There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.
From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?
C:\Users\Owner>irb | |
irb(main):001:0> require 'rest-client' | |
=> true | |
irb(main):002:0> r = RestClient::Resource.new 'www.google.ca' | |
=> www.google.ca | |
irb(main):003:0> r.get | |
Net::HTTP::Get | |
NoMethodError: undefined method `ntlm_auth' for Net::HTTP::Get:Class | |
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rest-client-1.6.3/lib/restclien | |
t/request.rb:113:in `net_http_request_class' |
require 'rest-client' | |
r = RestClient::Resource.new 'www.google.ca' | |
r.get |