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 "bundler/capistrano" | |
default_run_options[:pty] = true | |
set :user, 'user' | |
set :domain, 'SOMEDOMAIN.OR.IP' | |
set :application, "applcation_name" | |
set :repository, "/home/#{user}/git/#{application}.git/" | |
set :local_repository, "." | |
set :deploy_to, "/home/#{user}/#{application}" |
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
user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
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
module EmZendesk | |
require 'em-http' | |
class Base < SimpleModel::Base | |
has_attributes :zen_resource, :params, :username, :password, :response, :company_url | |
has_attributes :format, :default => 'json' | |
has_attributes :http_method, :default => :post | |
validate :validates_post_response | |
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
in the layout file | |
<% cache("header_cache_#{session_user.id}") do %> | |
some dynamic navigation and large select box | |
<%end%> | |
in the controller | |
expire_fragment("header_cache_#{session_user.id}") |
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
def self.guessing_game(values=[2.5,10.95,55.25],multi_sum=4,total_goal=79.65) | |
results = nil | |
total_amount = 0.0 | |
length = values.length | |
((multi_sum ** length) / (multi_sum)).times do |i| | |
total = 0 | |
possible = [] | |
total_amount = 0.0.to_d # use decimal for accuracy |
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
rake aborted! | |
undefined method `desc' for #<Bundler::GemHelper:0x00000101d83ab8> | |
/Users/joshmckin/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.10/lib/bundler/gem_helper.rb:24:in `install' | |
/Users/joshmckin/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.10/lib/bundler/gem_helper.rb:9:in `install_tasks' | |
/Users/joshmckin/Ventanex/vtx_operations/Rakefile:21:in `<top (required)>' | |
/Users/joshmckin/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load' | |
/Users/joshmckin/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/rake_module.rb:25:in `load_rakefile' | |
/Users/joshmckin/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:495:in `raw_load_rakefile' | |
/Users/joshmckin/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.0/lib/rake/application.rb:78:in `block in load_rakefile' |
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
class QueuedMessage < Aws::Sqs | |
def queued_messages | |
@queued_messages ||= [] | |
@queued_messages | |
end | |
def initialize(aws_access_key_id = AWS_ACCESS_KEY_ID, aws_secret_access_key = AWS_SECRET_ACCESS_KEY, params = {}) | |
super(aws_access_key_id, aws_secret_access_key,params) | |
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
module Mysql2 | |
module Fibered | |
class Client < ::Mysql2::Client | |
def query(sql, opts={}) | |
if ::EM.reactor_running? | |
super(sql, opts.merge(:async => true)) | |
deferrable = ::EM::DefaultDeferrable.new | |
::EM.watch(self.socket, Watcher, self, deferrable).notify_readable = true | |
fiber = Fiber.current | |
deferrable.callback do |result| |
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
/Users/joshmckin/test_mysq_gem/config/initializers/em_mysql2_adapter.rb:16:in `resume': dead fiber called (FiberError) | |
from /Users/joshmckin/test_mysq_gem/config/initializers/em_mysql2_adapter.rb:16:in `block in query' | |
from /Users/joshmckin/.rvm/gems/ruby-1.9.2-p180/gems/eventmachine-0.12.10/lib/em/deferrable.rb:141:in `call' | |
from /Users/joshmckin/.rvm/gems/ruby-1.9.2-p180/gems/eventmachine-0.12.10/lib/em/deferrable.rb:141:in `set_deferred_status' | |
from /Users/joshmckin/.rvm/gems/ruby-1.9.2-p180/gems/eventmachine-0.12.10/lib/em/deferrable.rb:180:in `fail' | |
from /Users/joshmckin/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.11/lib/active_record/connection_adapters/em_mysql2_adapter.rb:38:in `rescue in notify_readable' | |
from /Users/joshmckin/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.11/lib/active_record/connection_adapters/em_mysql2_adapter.rb:33:in `notify_readable' | |
from /Users/joshmckin/.rvm/gems/ruby-1.9.2-p180/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine' | |
from /Users/joshmckin/.rvm/gem |
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
class FoosController < ApplicationController | |
# GET /foos | |
# GET /foos.xml | |
def index | |
@foos = Foo.all | |
Foo.bad_method #should raise NoMethodError | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @foos } | |
end |