I hereby claim:
- I am hassox on github.
- I am hassox (https://keybase.io/hassox) on keybase.
- I have a public key ASB5a6LRY3Gb3-ZtU3F1NEyhxccQsiERk0td44Jtj0iAugo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Devise.setup do |config| | |
config.warden do |manager| | |
manager.intercept_401 = false | |
manager.default_strategies(scope: :user).unshift :jwtable | |
end | |
end |
defmodule Cvapp.Auth do | |
import Comeonin.Bcrypt, only: [checkpw: 2, dummy_checkpw: 0] | |
import Plug.Conn | |
def login(conn, user) do | |
conn | |
|> assign(:current_user, user) | |
|> Guardian.Plug.sign_in(user, :access) | |
end |
@also_valid_attrs %{email: "fas@nd.com", role: "client", is_financial_professional: true, password: "password"} | |
setup do | |
changeset = User.changeset(%User{}, @also_valid_attrs) | |
user = Repo.insert! changeset | |
{ :ok, jwt, full_claims } = Guardian.Plug.encode_and_sign(user, :api) | |
conn = conn() | |
|> put_req_header("accept", "application/vnd.api+json") |
$ ruby stacked_blocks.rb | |
START ARRAY THINGS | |
START ONE | |
START TWO | |
START THREE | |
START FOUR | |
IN THE MIDDLE OF ARRAYS DOING IT | |
FINISH FOUR | |
FINISH THREE | |
FINISH TWO |
09:52:35.045 request_id=oOTTwz6ywSK5RsianPnN [info] POST /users | |
RAW PARAMS | |
09:52:35.069 request_id=oOTTwz6ywSK5RsianPnN [debug] Processing by CloseBy.UserController.create | |
Accept: text/html | |
Parameters: %{"user" => %{"confirm_password" => "p", "email" => "foo@foobarbaz.com", "password" => "p"}} | |
%{"user" => %{"confirm_password" => "p", "email" => "foo@foobarbaz.com", | |
"password" => "p"}} | |
THE CREATE PARAMS params["user"] | |
%{"confirm_password" => "p", "email" => "foo@foobarbaz.com", "password" => "p"} | |
09:52:35.192 request_id=oOTTwz6ywSK5RsianPnN [info] Sent 422 in 147ms |
defmodule CloseBy.ApplicationController do | |
defmacro __using__(_opts) do | |
quote do | |
use Phoenix.Controller | |
import CloseBy.ApplicationController | |
alias CloseBy.Router | |
end | |
end | |
end |
require "benchmark" | |
hash = {'key' => 1, :key => 2} | |
n = 5_000_000 | |
Benchmark.bm do |x| | |
x.report("strings") { n.times { hash['key'] } } | |
x.report("symbols") { n.times { hash[:key] } } | |
x.report("strings, set") { n.times { hash['key'] = 1 } } |
module Concerns | |
# Wraps methods to provide lazy attribute evaluation | |
# If a value evaluates to a proc, the proc is called, and the value | |
# is returned | |
# | |
# @example | |
# class Foo | |
# include Concerns::LazyAttributes | |
# | |
# attr_accessor :bar |
" hint to keep lines short | |
if exists('+colorcolumn') | |
set colorcolumn=80 | |
endif |