Skip to content

Instantly share code, notes, and snippets.

class Graphics < Struct.new(:screen)
def initialize(*args)
super
extend_point_class
end
def extend_point_class
screen_centre = screen.size.map { |axis| axis / 2 }
[255, 1, 100].map(&coefficient.method(:*))
require 'кыргыз_тили'
puts 'өпкө'.илик_жөндөмөгө
puts 'жүрөк'.илик_жөндөмөгө
puts 'Никита'.илик_жөндөмөгө
puts 'Малик'.илик_жөндөмөгө
puts 'Даниил'.илик_жөндөмөгө
puts 'Калыс'.илик_жөндөмөгө
# -*- coding: utf-8 -*-
require 'active_support/all'
module RАлфавит
class << self
attr_accessor :жумшак_үнсүздөр, :каткалаң_үнсүздөр, :үнсүздөр, :үндүүлөр
end
self.үндүүлөр = %w(а е ё и о ө у ү ы э ю я).freeze
MAX_THREADS_PER_ACCOUNT = 5
common_job_queue = ...
loop do
registered_accounts.each do |account|
account_jobs = common_job_queue.extract_account_jobs(account)
account_jobs.each_slice(MAX_THREADS_PER_ACCOUNT) do |batch|
threads = batch.map do |job|
This file has been truncated, but you can view the full file.
=> [{"id"=>"3146", "order_id"=>"3146", "customer"=>[{"id"=>"0", "email"=>"", "first_name"=>"", "last_name"=>""}], "create_at"=>"2014-07-07 19:35:20", "currency"=>[{"name"=>"GBP", "code"=>"GBP", "symbol"=>"", "rate"=>1}], "billing_address"=>[{"id"=>"1", "type"=>"billing", "first_name"=>"Joseph", "last_name"=>"Montgomery", "postcode"=>"BT47 3LA", "address1"=>"42 Faughan Cresent", "address2"=>"", "phone"=>"02871302422", "city"=>"Londonderry", "country"=>[{"code2"=>"GB", "code3"=>"GBR", "name"=>"United Kingdom"}], "state"=>nil, "company"=>"", "fax"=>"", "website"=>nil, "gender"=>nil, "region"=>"", "default"=>"True", "email"=>"joemonty1978@gmail.com"}], "shipping_address"=>[{"id"=>"2", "type"=>"shipping", "first_name"=>"Joseph", "last_name"=>"Montgomery", "postcode"=>"BT47 3LA", "address1"=>"42 Faughan Cresent", "address2"=>"", "phone"=>"", "city"=>"Londonderry", "country"=>[{"code2"=>"GB", "code3"=>"GBR", "name"=>"United Kingdom"}], "state"=>nil, "company"=>"", "fax"=>"", "website"=>nil, "gender"=>nil, "region"=>
require 'celluloid'
class Cell
include Celluloid
def expensive
puts "[Started]"
sleep 1
puts "[Finished]"
end
require 'celluloid'
class Cell
include Celluloid
def expensive
puts "[Started]"
puts thread_count
10000000.times { 1 + 1 }
puts thread_count
#!/usr/bin/env ruby
require 'celluloid'
class Futurer
include Celluloid
def wait(seconds)
sleep seconds
seconds
end
require 'celluloid'
class Cell
include Celluloid
def initialize
@condition = Celluloid::Condition.new
end
def wait(number)