Skip to content

Instantly share code, notes, and snippets.

View jumski's full-sized avatar
🐴
For the lack of a nail, throw new HorseshoeNailNotFoundException("no nails!");

Wojtek Majewski jumski

🐴
For the lack of a nail, throw new HorseshoeNailNotFoundException("no nails!");
View GitHub Profile
@jumski
jumski / custom_plan.rb
Last active March 1, 2017 20:07
working zeus.json and fixes custom_plan.rb for zeus 0.13.3.rc2
require 'zeus/rails'
class CustomPlan < Zeus::Rails
def rspec
RSpec::Core::Runner.disable_autorun!
exit RSpec::Core::Runner.run(ARGV)
end
end
namespace :attachments do
task :migrate_to_s3 => :environment do
require 'aws/s3'
# Load credentials
s3_options = YAML.load_file(File.join(Rails.root, 'config/s3.yml')).symbolize_keys
bucket = s3_options[:bucket_name]
# Establish S3 connection
@jumski
jumski / tire-mappings.rb
Created April 8, 2013 08:47
tire mappings
module CopyIndexes
extend ActiveSupport::Concern
included do
include Tire::Model::Search
include Tire::Model::Callbacks
class Foo < ActiveRecord::Base
has_many :bars
belongs_to :baz
include IndexingHandler
indexed_associations :bars, :baz
end
Errno::ECONNRESET: Connection reset by peer
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/openssl/buffering.rb:174→ sysread_nonblock
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/openssl/buffering.rb:174→ read_nonblock
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/protocol.rb:141→ rbuf_fill
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/protocol.rb:122→ readuntil
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/protocol.rb:132→ readline
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:2562→ read_status_line
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:2551→ read_new
/home/deploy/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:1319→ block in transport_request
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:typens="urn:AllegroWebApi" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ins0="urn:AllegroWebApi"><env:Body><typens:doNewAuctionExt><session-handle>{{{KLUCZ SESJI WYCIETY}}}/session-handle><fields><fields><fid>5</fid><fvalue-string></fvalue-string><fvalue-int>1</fvalue-int><fvalue-float>0</fvalue-float><fvalue-image> </fvalue-image><fvalue-datetime>0</fvalue-datetime><fvalue-boolean>false</fvalue-boolean></fields><fields><fid>2</fid><fvalue-string></fvalue-string><fvalue-int>90539</fvalue-int><fvalue-float>0</fvalue-float><fvalue-image> </fvalue-image><fvalue-datetime>0</fvalue-datetime><fvalue-boolean>false</fvalue-boolean></fields><fields><fid>9</fid><fvalue-string></fvalue-string><fvalue-int>1</fvalue-int><fvalue-float>0</fvalue-float><fvalue-image> </fvalue-image><fvalue-datetime>0</fvalue-datetime><fvalue-boolean>false</fvalue-boolean><
@jumski
jumski / nginx.conf
Created February 8, 2013 09:38 — forked from ku1ik/nginx.conf
description "nginx http daemon"
start on runlevel [2]
stop on runlevel [016]
console owner
exec /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf -g "daemon off;"
respawn
#!/usr/bin/env jruby
# Usage:
# Save this file to /usr/local/bin/copy-to-s3.rb
# You'll want to chmod +x this file to use it on the command line (Linux/OS X: chmod +x /usr/local/bin/copy-to-s3.rb)
# If you're having trouble using JRuby, check out RVM (https://rvm.io/)
# Install the fog gem: gem install fog (after running rvm use jruby, if required)
# This only works if the environment variable JRUBY_OPTS=--1.8. e.g.: export JRUBY_OPTS=--1.8 (Linux/OS X)
# You'll have to edit the options in the file at the top to match your S3 settings.
#
module Antykwariusz
module_function
def fog
unless Thread.current[:fog]
opts = {
provider: 'AWS',
aws_access_key_id: S3_KEY,
aws_secret_access_key: S3_SECRET,
endpoint: "http://#{S3_ENDPOINT}/"
# From a fresh install of squeeze
apt-get install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -zxvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
rm -rf /tmp/ruby193