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:
Warden::Strategies.add(:bcrypt) do | |
def valid? | |
params[:username] || params[:password] | |
end | |
def authenticate! | |
return fail! unless user = User.first(:username => params[:username]) | |
if user.encrypted_password == params[:password] | |
success!(user) |
Object.prototype.autoload = function(type, filePath, includeAsType){ | |
var obj = undefined; | |
if(includeAsType === undefined) includeAsType = true; | |
this.__defineGetter__(type, function(){ | |
if(!obj){ | |
obj = require(filePath); | |
if(includeAsType) obj = obj[type]; | |
} | |
return obj; |
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") |
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 |
function thisIsATest(){ | |
return true; | |
} |