This file contains hidden or 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
import threading | |
import time | |
def cool_function(): | |
print "Herro!" | |
if __name__ == "__main__": | |
thread_limit = 5 | |
while True: |
This file contains hidden or 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
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 } |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
// Scrub Status | |
if (value < 1) | |
{ | |
value = 1; | |
} | |
// Pro Status | |
value = max(1, value); |
This file contains hidden or 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
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 |
This file contains hidden or 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
/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) |
This file contains hidden or 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 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 |
This file contains hidden or 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
# totally fine | |
Sequel.|( | |
Sequel.expr(:last_sent) < Time.now - repeat_threshold, | |
Sequel.expr(:last_sent) => nil | |
), | |
# instant runtime error |
This file contains hidden or 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 '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 |
This file contains hidden or 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
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 |