View application_controller.rb
class ApplicationController < ActionController::Base
before_action :set_return_to
def set_return_to
if !request.xhr? && request.format.html? && request.get?
session[:return_to] = request.url
end
end
end
View decimal_validator.rb
class DecimalValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
precision = options[:precision]
scale = options[:scale]
if !precision || !scale
raise ArgumentError, "#{self.class.name} expects :precision and :scale option"
end
View twitter_screenshot.js
// Takes a screenshot from a given Tweet.
// Usage: phantomjs twitter_screenshot.js https://twitter.com/Snowden/status/777557723118440448
var system = require("system"),
args = system.args;
var url = args[1];
if (!url) {
console.log("Please provide the URL to a Tweet.");
View heredoc.rb
ERB.new(<<MSG).result(binding)
Blah
ID CODE
--------------------------------------------------------
<% @codes.each do |id, code| %>
<%= id.ljust(20) %> <%= code %>
<% end %>
Blah
MSG
View keybase.md

Keybase proof

I hereby claim:

  • I am rubiii on github.
  • I am rubiii (https://keybase.io/rubiii) on keybase.
  • I have a public key whose fingerprint is A16E 8BE9 0170 59BF FC7B 5041 33B6 0CF6 F240 DD49

To claim this, I am signing this object:

View latest
#!/usr/bin/env ruby
require 'httpclient'
require 'json'
if ARGV.any?
gems = ARGV
else
puts 'feed me some gem name(s)!'
exit
View chk
#!/usr/bin/env ruby
require 'httpclient'
require 'json'
class Chk
RUBYGEMS_URL = 'http://rubygems.org/gems/%s'
NPM_URL = 'https://npmjs.org/package/%s'
View rsync-wtf.md

sources

app-js/**/*.js.coffee -> public/javascripts/compiled/

rsync -a --filter=P spec --filter=P *.js.map --filter=P *.js --delete -v app-js/ public/javascripts/compiled/

specs

View tldr.md

Savon 3.0 TL;DR

  • It requires Ruby 1.9 or higher.
  • It is based on the all-new Wasabi 4.0 which is the driving factor behind this version. This means, that we now require a WSDL! There's a TL;DR for Wasabi 4.0 as well and you should read it.
  • HTTP caused a lot of problems and questions which this project should not have to deal with at all, so I'm replacing HTTPI with a simple adapter you can overwrite for authentication, cookies, etc. Added benefit: you can also easily swap it out in your tests.
  • Thanks to the new parser, Savon can now create example requests and show you the types to use.
View tldr.md

Wasabi 4.0 TL;DR

  • It requires Ruby 1.9 or higher.
  • It is based on specifications and validates against real world WSDL documents.
  • It is way faster than ever before, while now parsing all elements.
  • It properly separates operations by service and port.
  • It supports WSDL and XML Schema imports.
  • It knows the input, output and fault message types.
  • It knows about Arrays of elements.