Skip to content

Instantly share code, notes, and snippets.

View nickcoyne's full-sized avatar
👾

Nick Coyne nickcoyne

👾
View GitHub Profile
@nickcoyne
nickcoyne / gist:ecfcf33aad48eaa9f5b1
Created May 19, 2015 20:46
derailed exec perf:mem (rails 3.2.21/ruby 2.1.5) 20 May 2015
$ RAILS_ENV=profiling bundle exec derailed exec perf:mem
Your Gemfile lists the gem dotenv-rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Booting: profiling
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from mon_synchronize at /Users/nick/.rbenv/versions/2.1.5/lib/ruby/2.1.0/monitor.rb:211)
You did not specify how you would like Rails to report deprecation notices for your profiling environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/profiling.rb
Endpoint: "/"
/Users/nick/.rbenv/versions/2.1.5/gem
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"
exit!
@nickcoyne
nickcoyne / paygate.rb
Created October 16, 2009 05:56
Paygate gateway for ActiveMerchant
require 'rexml/document'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
# Paygate is one of the leading CC gateways in South Africa
# see http://www.paygate.co.za
# Contributed by Nick Coyne (http://www.codevader.com)
class PaygateGateway < Gateway
URL = 'https://www.paygate.co.za/payxml/process.trans'
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /usr/www/users/sarahw/blog/wp-includes/media.php on line 1006
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /usr/www/users/sarahw/blog/wp-includes/media.php on line 424
Warning: imagejpeg(): supplied argument is not a valid Image resource in /usr/www/users/sarahw/blog/wp-includes/media.php on line 455
@nickcoyne
nickcoyne / deploy.rake
Created September 25, 2012 20:24 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@nickcoyne
nickcoyne / gist:6082437
Created July 25, 2013 18:29
Allow the cloudinary migration tool to run on Heroku, by using MySQL instead of sqlite.
require 'cloudinary'
require 'cloudinary/migrator'
class DbMigrator < Cloudinary::Migrator
def self.init
return if @@init
@@init = true
require 'tempfile'
end
2016-02-29T11:57:37+00:00 {"error":"EsRejectedExecutionException[rejected execution (queue capacity 200) on org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1@70475c64]","status":429}
2016-02-29T11:57:37+00:00 {"error":"RemoteTransportException[[dwalin-1][inet[/10.0.1.109:9300]][indices:data/write/index]]; nested: EsRejectedExecutionException[rejected execution (queue capacity 200) on org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1@3a9b376c]; ","status":429}
2016-02-29T11:57:37+00:00 {"error":"EsRejectedExecutionException[rejected execution (queue capacity 200) on org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1@765fa2ba]","status":429}
2016-02-29T11:57:23+00:00 {"error":"RemoteTransportException[[dwalin-1][inet[/10.0.1.109:9300]][indices:data/write/index]]; nested: EsRejectedExecutionException[rejected execution (queue capacity 200) on org.elasticsearch
EsRejectedExecutionException[rejected execution (queue capacity 50) on org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1@bfe2356];
EsRejectedExecutionException[rejected execution (queue capacity 50) on org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1@420985d9]
EsRejectedExecutionException[rejected execution (queue capacity 50) on org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$PrimaryPhase$1@48c29c4a];
var timoutWarning = 60000; // Display warning in 1 min.
var timoutNow = 60000; // Warning has been shown, give the user 1 minute to interact
var logoutUrl = '/timeout'; // URL to logout page.
var warningTimer;
var timeoutTimer;
// Start warning timer.
function StartWarningTimer() {
warningTimer = setTimeout("IdleWarning()", timoutWarning);