Skip to content

Instantly share code, notes, and snippets.

@thomasstr
thomasstr / bundle-error
Last active December 14, 2015 09:39
bundle install error windows
C:\Sites\pdfprawn>bundle install
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib/bundler/v
endor/net/http/persistent/ssl_reuse.rb:70:in `connect': SSL_connect returned=1 e
rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL
::SSL::SSLError)
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/
lib/bundler/vendor/net/http/persistent/ssl_reuse.rb:70:in `block in connect'
from D:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/timeout.rb:54:in `timeou
def credit
render :action => 'index' and return unless @cc.valid?
@response = paypal_gateway.purchase(BILL_AMOUNT, @cc,
:ip => request.remote_ip,
:billing_address => params[:billing_address])
if @response.success?
@purchase = Purchase.create(:response => @response)
redirect_to :action => "complete", :id => @purchase
@thomasstr
thomasstr / paypal-error
Created March 14, 2013 09:10
Getting error in purchase_controller.rb:37:in `credit' Line 4 here.
undefined method `on' for #<ActiveModel::Errors:0x007ff72d404300>
def credit
render :action => 'index' and return unless @cc.valid?
@response = paypal_gateway.purchase(price_in_cents, @cc,
:ip => request.remote_ip,
:billing_address => params[:billing_address])
if @response.success?
activemerchant (1.31.1) lib/active_merchant/billing/credit_card.rb:231:in `validate_card_number'
activemerchant (1.31.1) lib/active_merchant/billing/credit_card.rb:203:in `validate'
active_utils (1.0.5) lib/active_utils/common/validateable.rb:7:in `valid?'
app/controllers/purchase_controller.rb:37:in `credit'
actionpack (3.2.12) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.12) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.12) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.12) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.12) lib/active_support/callbacks.rb:436:in `_run__3617637069970058143__process_action__1511822576658534939__callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `__run_callback'
class PurchaseController < ApplicationController
before_filter :require_ssl, :only => [ :index, :credit ]
before_filter :load_card
#belongs_to :cart
BILL_AMOUNT = 1200
def index
#@cart = current_cart
#if @cart.nil?
<h2>Ny ordre</h2>
<%= content_tag('div', "There was an error processing your payment: #{@paypal_error}", :class => 'error') if @paypal_error %>
<%= simple_form_for @cc, :as => :creditcard, :url => { :action => 'credit' } do |f| %>
<p>Use the card number provided by your Sandbox account while testing</p>
<label>Card Number</label>
<%= f.input :number %>
<label>Card Type</label>
<%= f.select :brand, Purchase::PAYMENT_TYPES %>
@thomasstr
thomasstr / gist:5281879
Created March 31, 2013 20:22
current_cart method for application-controller
def current_cart
Cart.find(session[:cart_id])
rescue ActiveRecord::RecordNotFound
cart = Cart.create
session[:cart_id] = cart.id
cart
end
#encoding: utf-8
require "rubygems"
require "open-uri"
require "json"
class Gulesider
def getData(data, country_name)
json_profile = "xxx"
json_apikey = "xxx"
SimpleDateFormat smf = new SimpleDateFormat("dd-MM-YY HH:mm:ss");
smf.setTimeZone(TimeZone.getTimeZone("UTC"));
System.out.println(smf.format(new Date()));
System.out.println(smf.format(new Date(1000*60*10)));
System.out.println(new java.util.Date(1364768456));
1.9.3-p392 :014 > Rapns.push
(0.3ms) SELECT COUNT(*) FROM "rapns_apps"
Rapns::App Load (0.2ms) SELECT "rapns_apps".* FROM "rapns_apps"
Rapns::Notification Load (0.5ms) SELECT "rapns_notifications".* FROM "rapns_notifications" WHERE "rapns_notifications"."app_id" IN (1) AND (delivered = 'f' AND failed = 'f' AND (deliver_after IS NULL OR deliver_after < '2013-04-18 05:23:53.736935'))
Rapns::App Load (0.2ms) SELECT "rapns_apps".* FROM "rapns_apps" WHERE "rapns_apps"."id" = 1 LIMIT 1
[2013-04-18 07:23:54] [ERROR] OpenSSL::SSL::SSLError, SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/net-http-persistent-2.8/lib/net/http/persistent/ssl_reuse.rb:70:in `connect'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/net-http-persistent-2.8/lib/net/http/persistent/ssl_reuse.rb:70:in `block in connect'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.