Skip to content

Instantly share code, notes, and snippets.

import threading
import time
def cool_function():
print "Herro!"
if __name__ == "__main__":
thread_limit = 5
while True:
filter_key = "Ford"
store.keys.each do | key |
next if key == filter_key
store.delete key
end
# Or if you're feeling fancy
store.delete_if { |key, value| key != filter_key }
# You need to learn and master class and instance variables and moethods.
# Read these
#
# http://www.railstips.org/blog/archives/2009/05/11/class-and-instance-methods-in-ruby/ -- Methods
# http://www.railstips.org/blog/archives/2006/11/18/class-and-instance-variables-in-ruby/ -- Variables
#
require 'sequel' # Have to require this if we want to use Sequel
class Account
// Scrub Status
if (value < 1)
{
value = 1;
}
// Pro Status
value = max(1, value);
Skippping free! dj - oh, my god! - Title contains ambiguous buttsex
Skippping free! dj - one more romance - Title contains ambiguous buttsex
Skippping free! dj - oyasumi mae secret - Title contains ambiguous buttsex
Skippping free! dj - rn 25 - Title contains ambiguous buttsex
Skippping free! dj - room for two - Title contains ambiguous buttsex
Skippping free! dj - shark & dolphin rendezvous - Title contains ambiguous buttsex
Skippping free! dj - smile at fatalism - Title contains ambiguous buttsex
Skippping free! dj - splash honey! - Title contains ambiguous buttsex
Skippping free! dj - summer beast - Title contains ambiguous buttsex
/opt/rvm/gems/ruby-2.1.1/gems/sequel-4.9.0/lib/sequel/model/base.rb:1441:in `save': available is not a valid trueclass, completed is not a valid trueclass (Sequel::ValidationFailed)
class Series < Sequel::Model(:series)
one_to_many :chapters
def validate
validates_unique :title
validates_format /([0-9]{4})?/, :year
# validates_type TrueClass, :available
# validates_type TrueClass, :completed
# totally fine
Sequel.|(
Sequel.expr(:last_sent) < Time.now - repeat_threshold,
Sequel.expr(:last_sent) => nil
),
# instant runtime error
require 'json'
require 'awesome_print' # this is an external gem and you'll need to install it with the command "gem install awesome_print"
file_path = "monster_cards.json"
data = JSON.parse File.read file_path
card_name = "Raigeki"
ap data["R"][card_name] # If you have awesome print
puts data["R"][card_name] # If you don't have awesome print
get '/api/rising_and_falling' do
begin
data = CardPrices.success({"rising" => CardPrices::PriceStats.top_rising_cards,
"falling" => CardPrices::PriceStats.top_dropping_cards})
rescue
data = CardPrices.error "Failed to retrieve rising and falling price data."
end
content_type :json
return data.to_json