Skip to content

Instantly share code, notes, and snippets.

class Player
attr_reader :name, :turn
def initialize(name, turn)
@name = name
@turn = turn
end
end
class Judge
class Something
def happen(dependency)
dependency.use
end
end
class Dependency
def initialize
@used = false
end
require 'benchmark/ips'
@alphabet = Range.new('a', 'z').to_a.join(',')
def slow
@alphabet.gsub(',', '')
end
def fast
@alphabet.delete(',')
require 'redis'
class Storage
def initialize(name:)
@name = name
@storage = Redis.new
end
def add(value)
require 'temp_crawler/storage'
describe Storage do
subject(:storage) { described_class.new(name: 'name') }
before { storage.clear }
describe '#add(value)' do
it 'adds a uniq value' do
expect { storage.add('*') }.to change { storage.size }.by(1)
(defn show-page
[request]
(let [page-number (read-string (get-in request [:path-params :id]))]
(if (and (> page-number 7) (not (session/authenticated? request)))
(ring-resp/redirect "/sign-in")
(ring-resp/response (views/book-page book page-number)))))
(ns alice.pagination)
(defn paginate
"Split lines into pages"
([lines lines-per-page]
(paginate lines lines-per-page []))
([lines lines-per-page pages]
(if (empty? lines)
pages
(paginate (drop lines-per-page lines)
def human?(req)
req[:headers][:client] != 'google'
end
def auth?(req)
req[:params][:secret] == 'ruby'
end
def access_rules
{uri: '/admin', handler: {and: [:human?, :auth?]}}
# NOTE: There are Application pages we need to calculate progress for.
# Every page has specific rules/conditions how to estimate progress.
# Rules have scores/weights and they are used to calculate progress.
# pages = {
# home_page: { home_page_rule => score },
# info_page: { info_page_rule_1 => score_1, info_page_rule_2 => score_2 }
# }
module ApplicationProgress
module Rules
[ 02/17/2018 16:33:15 ]
Bitfinex: 10810.00 / 10811.00
OKCoin: 11531.78 / 11630.28
Bitstamp: 10821.86 / 10836.85
Gemini: 10850.00 / 10855.06
Kraken: 10847.00 / 10853.20
ItBit: 10850.00 / 10850.27
Poloniex: 10816.00 / 10816.00
GDAX: 10834.99 / 10835.00
QuadrigaCX: 10750.00 / 10900.00