(:identity req)
is auth backend independent way to access user data- login and logout implementation depends on auth backend
:current-user
doesn't imply that authentication is required, route should also have:auth-rules
if authentication is required
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
local setup = function() | |
local telescope = require("telescope") | |
local actions = require("telescope.actions") | |
local builtin = require("telescope.builtin") | |
local get_total_buffers = function() | |
local bufnrs = {} | |
local i = 1 | |
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do | |
if vim.fn.buflisted(bufnr) == 1 then |
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
(ns example.errors) | |
(defn clean-address [params] | |
"Ensure (params :address) is present" | |
(if (empty? (params :address)) | |
[nil "Please enter your address"] | |
[params nil])) | |
(defn clean-email [params] | |
"Ensure (params :email) matches *@*.*" |
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
class Organization | |
def to_param | |
"42" | |
end | |
def saved? | |
rand > 0.5 | |
end | |
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
class Organization | |
def to_param | |
"42" | |
end | |
def saved? | |
rand > 0.5 | |
end | |
end | |
class OrganizationCreator |
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 'rubygems' | |
require 'bundler' | |
Bundler.require | |
require './application' | |
namespace :assets do | |
desc 'compile assets' | |
task :compile => [:compile_js, :compile_css] do | |
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
# alternative to what is explained in the article Ruby Blocks as Dynamic Callbacks: | |
# http://www.mattsears.com/articles/2011/11/27/ruby-blocks-as-dynamic-callbacks | |
class Twitter | |
def tweet(msg, &block) | |
proxy = DSL[block] | |
publish(msg) | |
proxy.respond_with(:success) | |
rescue => e | |
proxy.respond_with(:failure, e.message) |
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
# Rakefile | |
namespace :db do | |
require "sequel" | |
namespace :migrate do | |
Sequel.extension :migration | |
DB = Sequel.connect(ENV['DATABASE_URL']) | |
desc "Perform migration reset (full erase and migration up)" | |
task :reset do |
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
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
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
require "minitest/autorun" | |
# inspired by some code from Chris Wanstrath (shared w. me by Ryan Smith) | |
# https://gist.github.com/25455 | |
# | |
# heavily modified by Gregory Brown at this point.. | |
def context(*args, &block) | |
return super unless (name = args.first) && block |
NewerOlder