Skip to content

Instantly share code, notes, and snippets.

View jaysson's full-sized avatar

Prabhakar Bhat jaysson

View GitHub Profile
@jaysson
jaysson / Dockerfile
Created January 28, 2024 09:32
Docker setup for AdonisJS V6
FROM node:lts-alpine3.19 AS builder
COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json
WORKDIR /app
RUN npm install
COPY ./ /app
RUN npm run build
FROM node:lts-alpine3.19
@jaysson
jaysson / readme.md
Last active December 30, 2023 05:38
Laravel server setup

This assumes root is logged in via SSH to the latest Ubuntu server, with the root SSH authorized keys stored in /root/authorized_keys. Another assumption is that you use postgres and redis hosted on different database servers, so we don't install those on the app server.

Server setup

Edit the SSH config and disable password login. Update the SSH port to something random.

vim /etc/ssh/sshd_config
systemctl reload sshd
@jaysson
jaysson / validation.ts
Last active July 15, 2023 06:03
Realtime validation in sveltekit
import { deserialize, applyAction } from '$app/forms';
import debounce from 'debounce';
/**
* After the first submission, asynchronously submits the form after new input
* The page action should return `fail(422, {data, errors}) when validation fails
* The actions should return a `fail(204, {data})` WITHOUT actually processing the form submission when `x-precognition` header is present and validation succeeds.
* Use it in your form: `<form method="post" use:validation>`
* @param form The form element on which the use directive is applied
*/
@jaysson
jaysson / TRPC.ts
Last active March 23, 2024 20:31
TRPC Integration for Adonis
import { initTRPC } from '@trpc/server';
import { resolveHTTPResponse } from '@trpc/server/http';
import { HttpContextContract } from '@ioc:Adonis/Core/HttpContext';
const t = initTRPC.create();
export const appRouter = t.router({
hello: t.procedure.query(() => {
return { message: 'World' };
}),
@jaysson
jaysson / react-project-gotchas.md
Last active March 21, 2018 07:56
React & related gotchas

Formik library: Always supply field names to mapPropsToValues. Otherwise, validations won't run on submit.

@jaysson
jaysson / progress_list.scss
Last active March 23, 2016 19:05
CSS Progress list
.progress-steps {
list-style: none;
padding: 0;
display: table;
table-layout: fixed;
width: 100%;
> li {
position: relative;
display: table-cell;
@jaysson
jaysson / gist:370033168cbacf06f68f
Last active August 29, 2015 14:15
Useful Git Commands
git add -A # Add all files to index, remove deleted files from index
git commit -am "Your message here" # Commit all modifications with a helpful message
git push remote branchname # Push changes to remote branchname
# If tracking is set, default remote is origin, branchname is current branch
# Add -p to remove remote branches which do not exist locally
# Add --all to push all branches
# Add -u to set local branches track remote branches. Recommended to do on initial push