# change mirror to ubuntu.osuosl.org first
sudo apt-get update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nginx + Unicorn for Rails on Rackhub | |
========= | |
## Description: | |
This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn. | |
## Installation: | |
Please make sure that your Gemfile in your rails application includes unicorn. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'deathbycaptcha' | |
require 'watir-webdriver' | |
@browser = Watir::Browser.new :firefox | |
@browser.goto "127.0.0.1:8080" | |
if @browser.alert.exists? | |
puts @browser.alert.ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
csv.drop(params[:is_column_headings].present? || params[:matched_columns].nil? ? 1 : 0).each_slice(500) do |rows| | |
ActiveRecord::Base.transaction do # Make sure all record persistance is rolled back if an exception occurs | |
rows.each do |row| | |
# load data | |
columns.values.each_with_index{|named_columns, i| data.merge!(named_columns => row[i]) if named_columns} | |
# build record | |
if duplicate_record?(is_skip_duplicates, data, current_user) | |
row << "This record is potentialy a duplicate and was not #{self.name.split("::")[1].downcase}ed." | |
status = "errors" | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):054:0> a = JSON.parse(open("http://127.0.0.1:3000/api/v1/proxies/list").read) | |
JSON::ParserError: 757: unexpected token at '"[{\"ip\":\"68.80.135.236\",\"port\":6515,\"updated_at\":\"2012-10-25T22:25:09Z\"},{\"ip\":\"54.247.66.62\",\"port\":8080,\"updated_at\":\"2012-10-25T22:26:21Z\"},{\"ip\":\"184.169.211.220\",\"port\":80,\"updated_at\":\"2012-10-25T22:26:56Z\"},{\"ip\":\"23.22.243.246\",\"port\":8080,\"updated_at\":\"2012-10-25T22:28:03Z\"}]"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###API CODE### | |
$:.push(File.dirname(__FILE__) + "../lib") | |
require "rack/api" | |
require 'json' | |
class ProxyResponse | |
def initialize(app) | |
@app = app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "nokogiri" | |
require "watir-webdriver" | |
browser = Watir::Browser.new :firefox | |
browser.goto "http://127.0.0.1:8080/" | |
browser.javascript_dialog.button('OK').click | |
if browser.alert.exists? | |
browser.alert.ok | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Tomcat Startup Script | |
CATALINA_HOME=/opt/tomcat6; export CATALINA_HOME | |
JAVA_HOME=/usr; export JAVA_HOME | |
TOMCAT_OWNER=rails; export TOMCAT_OWNER | |
start() { | |
echo -n "Starting Tomcat: " | |
su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for get nice format output from your rspecs you just need create the following file into the root project | |
.rspec #with the following content | |
--colour | |
--format nested |