Skip to content

Instantly share code, notes, and snippets.

View captproton's full-sized avatar

captproton captproton

View GitHub Profile
@captproton
captproton / gist:4573362
Created January 19, 2013 16:04
The image from @rbates railscasts doesn't process the image, and sidekiq gives me similar in another app. The image on S3 never eventually processes. How do I fix this?
localhost:app-my-event captainproton$ bundle exec sidekiq
2013-01-19T15:49:52Z 45905 TID-owyl39l24 INFO: Booting Sidekiq 2.6.4 with Redis at redis://localhost:6379/0
2013-01-19T15:49:52Z 45905 TID-owyl39l24 INFO: Running in ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-darwin12.2.1]
2013-01-19T15:49:52Z 45905 TID-owyl39l24 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2013-01-19T15:49:52Z 45905 TID-owyl39l24 INFO: Starting processing, hit Ctrl-C to stop
2013-01-19T15:50:19Z 45905 TID-owyl3lgq8 WARN: {"retry"=>true, "queue"=>"default", "class"=>"Painting::ImageWorker", "args"=>[9, "uploads/c2a30110-447d-0130-1ca4-2820661f01c7/DSCF2143.JPG"], "jid"=>"ad4d9b78243a517718caba4a"}
2013-01-19T15:50:19Z 45905 TID-owyl3lgq8 WARN: uninitialized constant Painting
2013-01-19T15:50:19Z 45905 TID-owyl3lgq8 WARN: /Users/captainproton/.rvm/gems/ruby-1.9.3-p362@app_my_event/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:230:in `block in constantize'
/Users/captainproton/.rvm/gems/ruby-1.9.3
@captproton
captproton / Lead.to_csv_good
Created August 16, 2012 03:53
Lead.to_csv works in console
>> Lead.to_csv
Lead Load (1.6ms) SELECT "leads".* FROM "leads"
=> "id,first_name,last_name,job_title,company,address,address2,state,postal_code,country,phone_number,email_address,created_at,updated_at,import_table_id\n1,First Name,Last Name,Job Title,Company,Address,,State,,Country,Phone,email,2012-07-14 00:17:06 UTC,2012-07-14 00:17:06 UTC,\n2,Karine,Smith,Professor,,,,not US,,USA,,,2012-07-14 00:17:06 UTC,2012-07-14 00:17:06 UTC,\n3,Violet,JOHNSON,Consultant,,,,CA,,U.S.A.,,,2012-07-14 00:17:06 UTC,2012-07-14 00:17:06 UTC,\n4,Jack,WILLIAMS,Manager,,,,CA,,United States,,,2012-07-14 00:17:06 UTC,2012-07-14 00:17:06 UTC,\n5,Riley,Smith,Electrical Engineer,,,,CA,,United States,,,2012-07-14 00:17:06 UTC,2012-07-14 00:17:06 UTC,\n6,Joshua,JOHNSON,Software Engineer,,,,CA,,United States,,,2012-07-14 00:17:06 UTC,2012-07-14 00:17:06 UTC,\n7,Jennifer,WILLIAMS,Student,,,,CA,,United States,,,2012-07-14 00:17:06 UTC,2012-07-14 00:17:06 UTC,\n8,Heather,Smith,VP Marketing,,,,CA,,United States,,,2012-07-14 00:17:06 UTC,
@captproton
captproton / bogus_csv_model
Created August 16, 2012 03:40
csv not working
class Lead < ActiveRecord::Base
def self.to_csv
CSV.generate do |csv|
csv << self.column_names.humanize.titleize
all.each do |lead|
csv << lead.attributes.values_at(*column_names)
end
end
end
@captproton
captproton / csv_bogus
Created August 16, 2012 03:38
csv not working
class LeadsController < ApplicationController
# GET /leads
# GET /leads.json
def index
@leads = Lead.all
@csv_leads = @leads.split(",")
respond_to do |format|
format.html # index.html.erb
@captproton
captproton / gist:2165519
Created March 22, 2012 23:42
RAILS_ENV=production bundle exec rake assets:precompile error with twitter bootstrap
RAILS_ENV=production bundle exec rake assets:precompile
/Users/heathertanner/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/heathertanner/.rvm/gems/ruby-1.9.2-p290@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
stack level too deep
(in /Users/heathertanner/Sites/techtalentfair.com/talentfair/app/assets/stylesheets/scaffolds.css.scss)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/heathertanner/.rvm/rubies/ruby-1.9....]
@captproton
captproton / index.html
Created November 28, 2011 04:31
d3 for mere mortals
<!doctype html>
<html>
<head>
<title>D3 for Mere Mortals</title>
<script type="text/javascript" src="http://www.recursion.org/d3.js"></script>
<script type="text/javascript" src="http://www.recursion.org/d3.time.js"></script>
<script type="text/javascript" src="http://www.recursion.org/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="http://www.recursion.org/prettify.js"></script>
<link href="http://www.recursion.org/prettify.css" type="text/css" rel="stylesheet"/>
@captproton
captproton / clock.rb
Created November 14, 2011 21:09
run workers on time
require 'clockwork'
include Clockwork
# Ruby 1.9.2 does not add the current directory in the LOAD_PATH, so we need to be more direct
require File.expand_path('../config/boot', __FILE__) #instead of: require 'config/boot'
require File.expand_path('../config/environment', __FILE__) # instead of: require 'config/environment'
handler do |job|
puts "Running #{job}"
end
@captproton
captproton / gist:1337479
Created November 3, 2011 19:07
clockwork feedback
$ bundle exec clockwork clock.rb
log/development.log
Rails Error: Unable to access log file. Please ensure that exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
DEPRECATION WARNING: config.action_view.debug_rjs will be removed in 3.1, from 3.1 onwards you will need to install prototype-rails to continue to use RJS templates . (called from ./config/environment.rb:5)
Starting clock for 1 events: [ marketpoint.job ]
Triggering marketpoint.job
Exception NameError -> uninitialized constant MarketPointJob
clock.rb:9
/Users/heathertanner/.rvm/gems/ruby-1.8.7-p334@clockwork/gems/clockwork-0.3.1/lib/clockwork.rb:29:in `call'
/Users/heathertanner/.rvm/gems/ruby-1.8.7-p334@clockwork/gems/clockwork-0.3.1/lib/clockwork.rb:29:in `run'
@captproton
captproton / clock.rb
Created November 3, 2011 19:00
attempt at clockwork and delayed_job
require 'config/boot'
require 'config/environment'
require 'delayed_job'
handler do |job|
puts "Running #{job}"
end
every(15.seconds, 'marketpoint.job') { Delayed::Job.enqueue MarketPointJob.new }
$ (set -x ; source "$HOME/.rvm/scripts/rvm" ) 2>&1 | tee rvm-init.log
+ source /Users/heathertanner/.rvm/scripts/rvm
++ declare -f rvm
++ [[ 0 -eq 0 ]]
++ for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
++ [[ -f /etc/rvmrc ]]
++ grep -q '^\s*rvm .*$' /etc/rvmrc
++ source /etc/rvmrc
+++ umask g+w
+++ export rvm_path=/usr/local/rvm