Skip to content

Instantly share code, notes, and snippets.

@jhahspu
jhahspu / basics.md
Last active June 6, 2023 06:28
next

Commands

  • npx create-next-app@latest . --no-git
    • create app in current dir without github
  • ``

WAI-AREA Landmark roles

All content should be within ARIA landmark roles. Roles should not be repeated on a single page.

Header

<!-- One / page -->
<header role="banner">

$facet

  1. match movies by genre.name
  2. movies go in results
  3. categories will contain a set of $genres.name
use('the_base');

function stageMatch(gen) {

Two Way Binding

<!-- Example 1 -->
<div x-data="{ input : '' }" class="flex justify-center mt-8">
    <input type="text" x-model="input" class="p-2 border-2 rounded shadow">
    <h3 class="mt-2"> Output:</h3>
    <p x-text="input" class="bg-red-100"></p>
</div>
@jhahspu
jhahspu / import_meta.md
Last active September 6, 2022 09:02
SEO

Explains what the shop sells and details like opening hours and location Get everything you need to sew your next garment. Open Monday-Friday 8-5pm, located in the Fashion District.

Use a snippet from the specific news article: Upsetting the small town of Whoville, a local elderly man steals everyone’s presents the night before an important event. Stay tuned for live updates on the matter.

Summarize the whole page: Learn how to cook eggs with this complete guide in 1 hour or less. We cover all the methods, including: over-easy, sunny side up, boiled, and poached.

@jhahspu
jhahspu / cart.md
Last active July 28, 2023 12:59
typescript
// A typesafe shopping cart in typescript.

// Immutable map :)

declare class Map<T, U> {
	set(t:T, u:U):Map<T, U>
	has(t:T):boolean;
	delete(t:T):Map<T,U>
@jhahspu
jhahspu / utils.md
Last active April 2, 2023 09:44
ffmpeg

FFmpeg

  • ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -b:a 128k -c:a libvorbis output.webm

    • contert mp4 to webm
  • ffmpeg -i "input.mp4" -vn -ar 44100 -ac 2 -ab 128k -f mp3 "output.mp3"

    • convert video to mp3
  • ffmpeg -ss 139 -t 26 -i "input.mp3" -acodec copy output.mp3

  • -ss start

Create serverless stack

npx create-serverless-stack@latest --language go APP_NAME

Other commands

  • npm run start
    • Start the local development environment
  • npm run test
  • Run your tests
@jhahspu
jhahspu / psql_4tbl_join.md
Last active May 2, 2022 17:27
PostgreSQL

sqlfiddle

Tables

CREATE TABLE courses(
  course_id int(10),
  course_name varchar(255)
);
      
@jhahspu
jhahspu / kube_basics.md
Last active February 13, 2022 19:08
Kubernetes

Cluster info

  • display information about cluster
    • kubectl cluster-info
  • connect to cluster
    • aws eks update-kubeconfig --name [cluster_name] --region eu-west-1
    • fix for permissions: open iam and add eks access
  • multiple contexts
  • kubectl config use-context [context]