Known component/view patterns:
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
// db.ts | |
import * as schema from "./schema" | |
export const db = drizzle(connection, { schema }) | |
//reset.ts | |
async function reset() { | |
const tableSchema = db._.schema | |
if (!tableSchema) { | |
throw new Error("No table schema found") |
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
# PATH: config/initializers/sidekiq_alive.rb | |
# AUTHOR: Andrei Makarov (github.com/amkisko) | |
# NOTE: now available as gem sidekiq_status_monitor (https://rubygems.org/gems/sidekiq_status_monitor) | |
class SidekiqAliveServer | |
attr_accessor :workers_size_threshold, | |
:process_set_size_threshold, | |
:queues_size_threshold, | |
:queue_latency_threshold, |
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
/*{ | |
"type": "action", | |
"targets": ["omnifocus"], | |
"author": "Otto Automator", | |
"identifier": "com.omni-automation.of.cross-link-2-objects", | |
"version": "1.1", | |
"description": "Appends a bidirectional link to the Note fields of two selected objects.", | |
"label": "Append Bidirectional Link", | |
"shortLabel": "Append Bidirectional Link", | |
"paletteLabel": "Append Bidirectional Link", |
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 Object::Proxy < SimpleDelegator | |
def initialize(object, **values) | |
super(object) | |
@values = values | |
end | |
def method_missing(name, ...) | |
@values.fetch(name) { super } | |
end | |
end |
This middleware does a few interesting things:
- Ensures a
url
shape in the zustand store, where we'll store URL information. - Assumes we will be storing our
url
state slice in the?state
search parameter after it has been stringified and base 64 encoded. - On creation, decodes stores state from the
?state
search parameter into theurl
slice of our store. - After each state update, updates the
?state
search parameter with the newurl
state slice. - Sets up an event listener that listens for
popstate
and re-decodes the state from the URL into our store.
Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.
You use Next.js router like normally, but don't define getStaticProps
and such. Instead you do client-only fetching with swr
, react-query
, or similar methods.
You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)
Don't like Next? Here's how to do the same in Gatsby.
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
# AUTHOR: Andrei Makarov (github.com/amkisko) | |
class ApplicationViewRecord < ApplicationRecord | |
self.abstract_class = true | |
def self.attribute_names | |
@attribute_names ||= attribute_types.keys | |
end | |
def self.load_schema! |
- I found 1 browser, 1 language, and 15 vulnerabilities in { Web Framework, HTTP Client library, Email library / Web Service, etc }
- All the vulnerabilities I found were found from a single perspective (I investigated maybe 50-80 products).
- The RFC description of the problem (rather confusingly) describes the requirements for this problem, while the WHATWG > HTML Spec is well documented.
- The problem is clearly targeted at the
Content-Disposition
fieldsfilename
andfilename*
. - This problem affects HTTP Request/Response/Email in different ways.
HTTP Request
: request tampering (especially with file contents, tainting of other fields, etc.)HTTP Response
: Reflect File Download vulnerability
Email
: Attachment tampering (e.g., extension and filename tampering and potential file content tampering)