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
source "https://rubygems.org" | |
gem 'sqlite3' | |
gem 'dry-logic', github: 'dry-rb/dry-logic', branch: 'master' | |
gem 'dry-types', github: 'dry-rb/dry-types', branch: 'master' | |
gem 'rom', github: 'rom-rb/rom', branch: 'master' | |
gem 'rom-sql', github: 'rom-rb/rom-sql', branch: 'master' | |
gem 'pry' |
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
package main | |
import ( | |
"fmt" | |
"github.com/julienschmidt/httprouter" | |
"net/http" | |
"log" | |
"database/sql" | |
_ "github.com/lib/pq" | |
"encoding/json" |
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 SuperCurry | |
def call(a, b) | |
puts "#{a} + #{b} = #{a + b}" | |
end | |
def curry(*args) | |
arity = method(:call).arity | |
curried_args = args | |
if curried_args.size == arity |
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
@start = false | |
t1 = Thread.new do | |
while !@start | |
sleep 0.001 | |
end | |
puts 'started 1' | |
end |
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
N = 10_000 | |
matched1 = 0 | |
matched2 = 0 | |
N.times do | |
seq = [1, 0, 0].shuffle | |
guess = rand(3) | |
matched1 += 1 if seq[guess].eql?(1) |
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
--color | |
--require spec_helper | |
--format Fuubar | |
--format ArduinoFormatter |
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.new do | |
def self.name; "Ничейщик"; end | |
def self.inspect; "Ничейщик"; end | |
def self.Ничейщик; Ничейщик; end | |
def whoami? | |
self.class.name | |
end |
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 CreateSettings < ActiveRecord::Migration | |
def change | |
create_table :settings do |t| | |
t.string :key | |
t.string :human_name | |
t.text :value | |
t.timestamps null: false | |
end | |
end | |
end |
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 Array | |
undef :each | |
def each | |
return to_enum(__callee__) unless block_given? | |
size.times do |i| | |
yield self[i] | |
end | |
end |
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 'rails_helper' | |
RSpec.describe UserReport do | |
# Jun | Aug | Sep | |
#-----|--|--|--|--|--|--|--> time | |
# * | * * | | |
# | |
# Short periods - weeks | |
# Stars - timelogs |