Skip to content

Instantly share code, notes, and snippets.

@lucasprag
lucasprag / Gemfile
Last active May 7, 2021 14:24 — forked from mbajur/Gemfile
Liquid, Handlebars, Erb and gsub benchmarks
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'liquid'
gem 'ruby-handlebars'

Keybase proof

I hereby claim:

  • I am lucasprag on github.
  • I am lucasprag (https://keybase.io/lucasprag) on keybase.
  • I have a public key ASChddlvcPbpDGTvh-JTu2EEaUhLuudGcR5bsz2-yExnfQo

To claim this, I am signing this object:

@lucasprag
lucasprag / seed_user.rb
Created March 2, 2018 17:54
seed_user.rb
User.create(first_name: '', last_name: '', email: 'yourname@attendease.com', password: 'test42')
@lucasprag
lucasprag / routes.rb
Last active September 16, 2017 18:51
Rails.application.routes.draw do
scope :admin do
resources :pages do
resources :sections
end
resources :posts
resources :categories
resource :settings
module MeuSite
class Application < Rails::Application
# ...
config.middleware.use = HelloHeader
# insere o NovoMiddleware DEPOIS do MiddlewareExistente
config.middleware.insert_after(MiddlewareExistente, NovoMiddleware)
module MeuSite
class Application < Rails::Application
# ...
config.middleware.use = HelloHeader
end
end
class HelloHeader
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
headers['Hello'] = 'World'
[status, headers, body]
module ActiveRecord
class Migration
class CheckPending
def initialize(app)
@app = app
end
def call(env)
ActiveRecord::Base.logger.silence do
ActiveRecord:: Migration.check_pending!
<% @posts.each do |post| %>
<h3><%= post.title %></h3>
<p><%= post.content %></p>
<% end %>
@lucasprag
lucasprag / blog_controller.rb
Created September 15, 2017 17:28
blog_controller.rb
class BlogController < ApplicationController
def index
@posts = Post.all
end
end