I hereby claim:
- I am kidpollo on github.
- I am kidpollo (https://keybase.io/kidpollo) on keybase.
- I have a public key ASD3Rhho5U14SMrLQ9gNilg9-YssXS9hiovYVCkqFw3aFwo
To claim this, I am signing this object:
(ns local | |
{:clj-kondo/config '{:lint-as {promesa.core/let clojure.core/let | |
applied-science.js-interop/fn clojure.core/fn | |
applied-science.js-interop/defn clojure.core/defn}}} | |
(:require [cljs-bean.core :refer [->clj ->js]] | |
[promesa.core :as p] | |
["http" :as http] | |
["url"] | |
[applied-science.js-interop :as j] | |
[clojure.string :as string] |
(ns foo | |
{:clj-kondo/config '{:lint-as {promesa.core/let clojure.core/let | |
applied-science.js-interop/defn clojure.core/defn}}} | |
(:require [cljs-bean.core :refer [->clj ->js]] | |
[ruuter.core :as ruuter] | |
["axios$default" :as axios] | |
[clojure.string :as string] | |
[promesa.core :as p] | |
[applied-science.js-interop :as j])) |
# Install iterm 2 https://www.iterm2.com/ | |
# Install 1password | |
#install homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/paks/.zprofile | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
# packages | |
brew install git git-crypt gpg autojump kube-ps1 stern asdf rlwrap rg |
(ns app.api-server | |
(:require [compojure.core :as compojure] | |
[com.stuartsierra.component :as component] | |
[app.app :as app] | |
[ring.adapter.jetty :as jetty])) | |
(compojure/defroutes app | |
app/handler) | |
(defrecord AppServer [port server] |
# do https://gist.github.com/jed/6147872 and then do this to proxy your app | |
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { | |
listen 80; |
require 'mail' | |
require 'thread' | |
require 'parallel' | |
require 'benchmark' | |
Mail.defaults do | |
delivery_method :smtp, options | |
end |
I hereby claim:
To claim this, I am signing this object:
Pundit has a helper method policy_scope
that can be used in controllers and views that basicaly a class finder. It is equivalent to:
@posts = policy_scope(Post)
@posts = PostPolicy::Scope.new(current_user, Post).resolve
Using the helper is a nice approach because you dont have to remember what Scope class you need. This is all fine and well on a world where the app is single teanant or the auth logic to reslove scopes needs no other context but the user and the resource that is being requested.
In our world almost all requests are nested under a company context and require a current user to determine membership role to present certain data.
class PostCallbacks | |
def after_create | |
MagicBus::PostStream.new(self, 'create').enqueue | |
end | |
def after_update | |
MagicBus::PostStream.new(self, 'update').enqueue | |
end | |
def after_destroy |
module V1 | |
class BaseController < ApplicationController | |
include V1::ResponseMetaData | |
include V1::ErrorHandling | |
include V1::ReadOnly | |
include Pundit | |
rescue_from Pundit::NotAuthorizedError, with: :render_401 | |
rescue_from ActiveRecord::RecordInvalid, :with => :render_422 | |
def warden |