- like Pastebin but for Pokemon teams
- anyone can access the site and create an annonymous team
- teams get urls like: http://pokebin.io/963fc4d
- annonymous teams persist for 1 month and then are marked for deletion
- teams marked for deletion are deleted when they are not visited for 2 consecutive days
- spam filters and rate limiting to curb abuse
- users can optionally sign up to have their teams persist forever
- JSON api: http://pokebin.io/963fc4d.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile(true) do | |
source "http://rubygems.org" | |
gem "activerecord", "~> 4.2" | |
gem "sqlite3" | |
end | |
require "active_record" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Circle | |
def initialize(radius:) | |
@radius = radius | |
end | |
def area | |
Math::PI * (@radius ** 2) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OnlineMigration | |
class << self | |
def online(&block) | |
# OnlineVerifier runs the syntax inside the block. It only has methods | |
# defined that we agree are safe for online migrations. If you use an | |
# unsafe method inside the online {} block, the class won't load. | |
verifier = OnlineVerifier.new | |
verifier.instance_eval(&block) | |
define_method(:change, &block) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MySQL. Versions 4.1 and 5.0 are recommended. | |
# | |
# Install the MySQL driver: | |
# gem install mysql2 | |
# | |
# And be sure to use new-style password hashing: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: &dev | |
adapter: mysql2 | |
encoding: utf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "you" do | |
subject(:you) { FactoryGirl.create :you } | |
it "wants the truth" do | |
expect(you).to want_the_truth | |
end | |
it "can't handle the truth" do | |
expect(you.can_handle?(:truth)).not_to be_true | |
end |
Persephone provides a HTTP-based, RESTful web API wrapper around Capistrano tasks. The intent is to allow Capistrano tasks to be executed via web interfaces, chat bots, native applications, etc. without having to manually SSH in to a server and issue commands.
Persephone is a simple Sinatra app that is distributed as a gem.
Add the gem to your Gemfile:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
namespace :sql do | |
desc "Load database from SQL dump" | |
task :load => [:environment, :reset] do | |
ARGV.shift | |
file = ARGV.shift | |
name_and_extensions = file.split(".") | |
name = name_and_extensions.shift | |
extensions = name_and_extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use tap to modify an object and then return it immediately | |
# before... | |
def foo | |
obj = Foo.new | |
obj.attribute = :value | |
obj | |
end | |
# after... | |
def foo |