HTTP Verb Route Model->method() Description
-----------------------------------------------------------------------------------------
GET /posts posts->index() display a list of all posts
GET /posts/new posts->new() return an HTML form for creating a new post
POST /posts posts->create() create a new post
GET /posts/:id posts->show() display a specific post
GET /posts/:id/edit posts->edit() return an HTML form for editing a post
PATCH/PUT /posts/:id posts->update() update a specific post
DELETE /posts/:id posts->destroy() delete a specific post
This file contains hidden or 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
// User password resets could benefit from railroad error handling | |
// because there are so many things to go wrong along the way | |
// | |
// 1. I forgot my password, send me a link | |
// 2. I got the link, let me enter a new password | |
// 3. Password and confirmation must match | |
// 4. Password must be at least 8, etc | |
// 5. Password was saved successfully | |
// | |
// There are many things that can go wrong and having a transaction |
This file contains hidden or 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
# stages: | |
# - whatever | |
# - test | |
vitest: | |
stage: test | |
script: | |
# assuming scripts: has "test": "vitest" ... | |
# run your tests with coverage output | |
- npm test -- run --coverage |
This file contains hidden or 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
#[cfg(test)] | |
use mockall::{automock, predicate::*}; | |
pub struct Visa {} | |
#[cfg_attr(test, automock)] | |
pub trait Chargable { | |
fn charge_credit_card(&self) -> u32; | |
} |
This file contains hidden or 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
! youtube shorts | |
www.youtube.com###guide-content #endpoint[title="Shorts"]:upward(ytd-guide-entry-renderer) | |
www.youtube.com###items #endpoint[title="Shorts"]:upward(ytd-mini-guide-entry-renderer) | |
www.youtube.com##ytd-browse ytd-grid-video-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer:has-text(/\s(0:\d\d|1:0\d)\s/)) | |
www.youtube.com##ytd-browse ytd-rich-item-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer:has-text(/\s(0:\d\d|1:0\d)\s/)) | |
www.youtube.com##ytd-search ytd-video-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer:has-text(/\s(0:\d\d|1:0\d)\s/)) | |
www.youtube.com##ytd-watch-next-secondary-results-renderer ytd-compact-video-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer:has-text(/\s(0:\d\d|1:0\d)\s/)) | |
www.youtube.com##ytd-browse ytd-grid-video-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer[aria-label="Shorts"]) | |
www.youtube.com##ytd-browse ytd-rich-item-renderer:has(span.ytd-thumbnail-overlay-time-status-renderer[aria-label="Shorts"]) | |
www.y |
This file contains hidden or 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
// Theo's Enum Avoidance, Implemented | |
// https://www.youtube.com/watch?v=Anu8vHXsavo | |
// don't do this --------------------------------------------------- | |
enum UserRole { | |
User, | |
Admin, | |
Staff | |
} |
This file contains hidden or 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
{ | |
// for next, remix and solid index routes that uses the directory name for the component name | |
"export default function": { | |
"prefix": "edf", | |
"body": [ | |
"export default function ${TM_DIRECTORY/^.+\\/(.*)$/${1:/pascalcase}/}() {", | |
"\treturn(", | |
"\t\t${0}", | |
"\t)", | |
"}" |
This file contains hidden or 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
// app/services/notice.server.ts | |
const { getSession, commitSession, destroySession } = | |
createCookieSessionStorage({ | |
cookie: { | |
name: "notice", | |
sameSite: "lax", | |
path: "/", | |
httpOnly: true, | |
secrets: [process.env.COOKIE_SECRET || "CHANGEME"], | |
secure: process.env.NODE_ENV === "production", |
Not a whole lot of info out there about this. I understand that bun is in beta at the moment. I just wanted to see where it's at. Remix doesn't really care too much about the runtime since it's tied to standard APIs. However, it's still SSR so ... how to run in prod etc?
bun.sh has the instructions but basically run the curl/bash one-liner command even if you are on zsh
or fish
.
bun --version
0.2.2