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 'time' | |
require 'ruby2d' | |
DEFAULT_FONT = 'DejaVuSansMono.ttf' | |
DEFAULT_FONT_SIZE = 12 | |
DEFAULT_FONT_COLOR = 'green' | |
def get_info_text(tick) |
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
#!/bin/bash | |
dir="$(dirname "$0")" | |
bold="$(tput bold)" | |
normal="$(tput sgr0)" | |
function get_token { | |
(exec http --ignore-stdin --timeout 180 post $1/auth/get_token username=$2 password=$3 | jq -r .token) | |
} |
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
module Dry | |
module Effects | |
CONTINUE_HANDLER_REGISTRY = {} | |
module Handler | |
def self.Continue(context_name) | |
Module.new do | |
define_method("with_#{context_name}") do |handlers_hash, &block| | |
::Dry::Effects::CONTINUE_HANDLER_REGISTRY[context_name] = handlers_hash |
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 "https://rubygems.org" | |
gem 'dry-types', github: "dry-rb/dry-types", branch: 'master' | |
gem 'dry-struct', github: "dry-rb/dry-struct", branch: 'master' | |
gem 'rspec' | |
gem 'timecop' | |
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
require 'thread' | |
# input_queue = Queue.new | |
# computer = Thread.new do | |
# loop do | |
# x, y, block, output_queue = input_queue.pop | |
# puts "computing #{x} + #{y}" | |
# sleep 1 | |
# puts "calling block" |
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
level = 0 | |
call_trace = TracePoint.new(:call) do |event| | |
indent = ' ' * level | |
Rails.logger.info("#{indent}#{level} : #{event.event} " + | |
"#{event.defined_class}\##{event.method_id} " + | |
"@ #{event.path}:#{event.lineno}") | |
level += 1 | |
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
Started GET "/canteens/20/edit" for 127.0.0.1 at 2014-07-09 21:23:24 +0200 | |
Processing by CanteensController#edit as HTML | |
Parameters: {"id"=>"20"} | |
[1m[36mUser Load (0.8ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = 18 ORDER BY "users"."id" ASC LIMIT 1[0m | |
finding canteen | |
0: call ActiveSupport::Dependencies::ModuleConstMissing#const_missing | |
/home/jakub/.rvm/gems/ruby-2.1.2@objednavky/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:178 | |
1: call Module#anonymous? | |
/home/jakub/.rvm/gems/ruby-2.1.2@objednavky/gems/activesupport-4.1.4/lib/active_support/core_ext/module/anonymous.rb:16 | |
1: return Module#anonymous? |
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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'sqlite3' | |
GEMFILE | |
system 'bundle' | |
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
#!/usr/bin/env ruby | |
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
# gem 'rails', github: 'rails/rails' | |
gem 'rails' | |
gem 'sqlite3' | |
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
Gems included by the bundle: | |
* actionmailer (4.0.0) | |
* actionpack (4.0.0) | |
* activemodel (4.0.0) | |
* activerecord (4.0.0) | |
* activerecord-deprecated_finders (1.0.3) | |
* activesupport (4.0.0) | |
* addressable (2.3.5) | |
* annotate (2.5.0) | |
* arel (4.0.1) |
NewerOlder