Skip to content

Instantly share code, notes, and snippets.

View thetutlage's full-sized avatar
🏠
Working from home

Harminder Virk thetutlage

🏠
Working from home
View GitHub Profile
@thetutlage
thetutlage / tailwind.config.js
Last active March 16, 2024 17:13
TailwindCSS config file for the AdonisJS polls app
/** @type {import('tailwindcss').Config} */
export default {
content: ['./resources/**/*.edge', './resources/**/*.{js,ts,jsx,tsx,vue}'],
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'system-ui', 'sans-serif'],
},
colors: {
primary: '#8E52A9',
@thetutlage
thetutlage / story.md
Created May 6, 2023 06:25
HTML forms and surprises

HTML forms and surprises

If you are using Rails, Laravel, or AdonisJS (the only one's I know), then these inconsistencies are handled automatically for you.

HTML forms have particular serializing behavior attached to them that you need to understand and address to work with normalized data in your applications.

I see a few talking about it because we stopped using HTML forms with the rise of frontend frameworks. However, they are now returning to HTML forms, so I expect more developers to encounter these surprises.

Empty fields lead to empty strings

@thetutlage
thetutlage / .zshrc
Created November 3, 2022 16:08
Open current repo in Github
openRepo() {
githubDomain="https://github.com/"
remoteUrl="$(git config --get remote.origin.url)"
branch="$(git rev-parse --abbrev-ref HEAD)"
# Replace git protocol with github domain
remoteUrl="${remoteUrl/git\@github\.com\:/$githubDomain}"
# Replace `.git` suffix
remoteUrl="${remoteUrl/.git/}"
@thetutlage
thetutlage / markdown.css
Created February 14, 2022 01:39
TailwindCSS styles for styling markdown content for AdonisJS
.markdown {
@apply text-prose font-body text-gray-800;
}
/**
* ------------------------------------------------------
* Headings
* ------------------------------------------------------
*/
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5 {
@thetutlage
thetutlage / context.ts
Last active April 19, 2024 14:50
Unploy Server API Abstraction for AdonisJS
import Up from './index'
declare module '@ioc:Adonis/Core/HttpContext' {
interface HttpContextContract {
up: Up
}
}
@thetutlage
thetutlage / 01_contracts_validator.ts
Last active September 7, 2021 03:33
AdonisJS custom validation rule for disallowing emojis
// Save inside contracts/validator.ts
declare module '@ioc:Adonis/Core/Validator' {
interface Rules {
disallowEmoji(): Rule
}
}
@thetutlage
thetutlage / help.md
Last active February 5, 2021 15:09
Help me prioritize

I want to spend some time creating a great course on AdonisJS.

I personally DO NOT want to keep it super simple, like a todo app or a blog without any design. I understand that these tutorials does help understand the basics of the framework, but they do not do justice with what you can achieve by using AdonisJS.

Now, I have couple of ideas in mind. Lemme dump them here and use your feedback to make an informed decision.

An end to end application (Approach A)

Creating a little complex end to end application that deals with multiple things at a given point of time. For example: An application that has

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Color Space</key>
<string>sRGB</string>
<key>Blue Component</key>
<real>0.1803921568627451</real>
@thetutlage
thetutlage / test.js
Last active August 19, 2020 21:09
Jest test suite game
const actions = {}
describe('Broken suite', () => {
beforeAll(() => {
actions.all = {}
actions.all.before = true
})
beforeEach(() => {
actions.each1 = {}
@thetutlage
thetutlage / readme.md
Created May 25, 2020 14:33
Double accounting Ledger

Ledger Service

Ledger service is a living implementation of Double Entry Accounting. Using concrete principles of accounting, the ledger service ensures that all money transferred between accounts is properly recorded with trail log for each and every transaction.

Features

The features set of the Ledger service is output of the initial understanding of the functionalities required to run other parts of the application.

  1. Built around double entry accounting principles.
  2. First class support for transaction reversal without loosing any history.