Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Oskar Szrajer gotar

🏠
Working from home
Block or report user

Report or block gotar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vimrc
set nocp
set encoding=utf-8
call plug#begin('~/.vim/plugged')
let g:plug_url_format = 'git@github.com:%s.git'
Plug 'kien/ctrlp.vim'
Plug 'rking/ag.vim'
Plug 'tpope/vim-bundler'
@gotar
gotar / .vimrc
Created Aug 11, 2016
vimrc file
View .vimrc
set nocp
set encoding=utf-8
call plug#begin('~/.vim/plugged')
Plug 'kien/ctrlp.vim'
Plug 'rking/ag.vim'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-endwise'
@gotar
gotar / db.rake
Created May 16, 2016 — forked from rpanachi/db.rake
Rakefile for Sequel database operations
View db.rake
namespace :db do
require 'sequel'
Sequel.extension(:migration)
MIGRATIONS_PATH = 'db/migrations'
def db_conn_env
ENV["BOOKSHELF_DATABASE_URL"]
end
View combine.rb
chat: {
id: 1,
owner_id: 1,
member_id: 2
}
user1: {
id: 1
name: 'Foo'
}
View test_mapper.rb
require 'rom-mapper'
class MyMapper1 < ROM::Mapper
reject_keys true
attribute :foo, from: [:bar, :baz] do |bar, baz|
[bar, baz]
end
end
@gotar
gotar / json_api.rb
Created Aug 12, 2015
Mapping raw tuple to jsonapi using rom-mapper and yaks
View json_api.rb
require 'anima'
require 'rom-mapper'
require 'yaks'
class User
include Anima.new(:id, :first_name, :last_name, :posts)
end
class Post
include Anima.new(:id, :title)
View gist:e695cc88b1884f90f570
require 'transproc/all'
require 'addressable/uri'
##
# Convert string keys to symbols
#
transform = Transproc(:symbolize_keys)
data = {
'name' => 'Mark Rickerby',
View 1_create_products.rb
Sequel.migration do
up do
run 'CREATE EXTENSION "uuid-ossp"'
create_table :products do
column :id, :uuid, :default => Sequel.function(:uuid_generate_v4), :primary_key => true
end
end
end
View gist:15df9116d61f6f13ce09
require 'lotus/validations'
module UserValidations
include Lotus::Validations
attribute :login, presence: true, format: /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/
attribute :password, presence: true, confirmation: true, size: 8..64
end
class User
View gist:2b9b6d7f0238686b4971
Verifying that +gotar is my openname (Bitcoin username). https://onename.io/gotar
You can’t perform that action at this time.