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 'virtus' | |
class User | |
include Virtus.model | |
attribute :name, String | |
attribute :age, Integer | |
attribute :birthday, Date | |
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
user: tiagopog | |
hosts: | |
"beautydate.dev": | |
listen: | |
port: 80 | |
paths: | |
/: | |
proxy.reverse.url: http://localhost:3000/ | |
proxy.preserve-host: ON | |
proxy.timeout.io: 5000 |
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
user nobody; | |
worker_processes 1; | |
#pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
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 'sequel' | |
DB = Sequel.connect('postgres:///beautydate_dev') | |
puts DB[:users].where(name: /ti/i).first | |
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
def print_enum(enum) | |
puts enum | |
puts enum.inspect | |
end | |
# Example: 1 | |
enum = %w(foo bar).each | |
print_enum(enum) | |
3.times { puts enum.next } rescue nil |
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 JsonapiUtils | |
extend ActiveSupport::Concern | |
include do | |
helper_method :jsonapi_serialize, :jsonapi_serialize_collection | |
end | |
def jsonapi_serialize_collection(records) | |
records = records.map { |record| @request.resource_klass.new(record) } | |
jsonapi_serialize(records) |
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
user nobody; | |
worker_processes 1; | |
#pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
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
# This file is used by Rack-based servers to start the application. | |
require ::File.expand_path('../config/environment', __FILE__) | |
class MyMiddleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
puts 'foobar' |
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
user nobody; | |
worker_processes 1; | |
#pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
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
# frozen_string_literal: true | |
class User | |
attr_accessor :admin | |
def initialize(options = {}) | |
@admin = options[:admin] || false | |
end | |
def admin?; @admin end |