Skip to content

Instantly share code, notes, and snippets.

View blelump's full-sized avatar

Michał Pietrus blelump

View GitHub Profile
module Entities
end
rom = ROM.container(:sql, 'sqlite::memory') do |conf|
conf.gateways[:default].use_logger(Logger.new($stdout))
conf.default.create_table(:users) do
primary_key :id
column :login, String
rom = ROM.container(:sql, 'sqlite::memory') do |conf|
conf.gateways[:default].use_logger(Logger.new($stdout))
conf.default.create_table(:users) do
primary_key :id
column :login, String
end
conf.default.create_table(:tasks) do
primary_key :id
rom = ROM.container(:sql, 'sqlite::memory') do |conf|
conf.gateways[:default].use_logger(Logger.new($stdout))
conf.default.create_table(:users) do
primary_key :id
column :login, String, null: false
end
conf.default.create_table(:employees) do
primary_key :id
@blelump
blelump / mapper.rb
Last active March 17, 2018 10:58
ROM Mapper issue
require 'bundler'
require 'dry-types'
Bundler.require
module Types
include Dry::Types.module
end
rom = ROM.container(:sql, 'sqlite::memory') do |conf|
conf.gateways[:default].use_logger(Logger.new($stdout))
@blelump
blelump / autoscale_req.rb
Created April 27, 2015 14:41
Sample Ruby code to create/update Azure autoscale availability set
require "azure"
require 'azure/base_management/management_http_request.rb'
require 'azure/core/http/http_request'
Azure.configure do |config|
config.storage_account_name = "storage_account_name"
config.storage_access_key = "storage_access_key"
config.management_certificate = "cert.pfx"
config.subscription_id = "subscription_id"
end
@blelump
blelump / aws_signed_request_v4.rb
Last active December 8, 2022 15:51
Sample Ruby code to create AWS signed request version 4 (with request headers)
#Signing AWS Requests By Using Signature Version 4
#http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
require 'uri'
require 'openssl'
require 'net/http'
require 'cgi'
method = 'GET'
service = 'iam'