Skip to content

Instantly share code, notes, and snippets.

View tigawanna's full-sized avatar

Dennis kinuthia tigawanna

  • Nairobi Kenya
View GitHub Profile
@tigawanna
tigawanna / Recursive_typescript_types.md
Last active October 21, 2024 13:46
Recursive typescript types

Recursive type helpers

inspired by the typed pocketbase library

type Join<K, P> = K extends string | number
  ? P extends string | number
    ? `${K}${"" extends P ? "" : "."}${P}`
@tigawanna
tigawanna / windows_powershell_aliases.md
Created May 29, 2024 14:54
How to add aliases in windows powershell

In this example we'll alias pp to pnpm

  • check powerchell profile location
 echo $profile

Note

powershell <7 is usually on : C:\Users\denni\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 powershell 7+ is usually on : C:\Users\denni\OneDrive\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

@tigawanna
tigawanna / simple_vlsx.md
Created January 15, 2024 05:16
simple vlsx (airbnb) visualisation
"use client";
import { SiSolid } from "react-icons/si";
import { FaReact } from "react-icons/fa";
import { SiSvelte } from "react-icons/si";
import { FaVuejs } from "react-icons/fa";
import { SiDeno } from "react-icons/si";
import { SiRemix } from "react-icons/si";
import { TbBrandNextjs } from "react-icons/tb";
import { SiNuxtdotjs } from "react-icons/si";
@tigawanna
tigawanna / vlsx_visulize.md
Created January 15, 2024 03:25
Visualizing react list items with vlsx from airbnb

Visualize most Used Libraries

i had a list of top libraries i use and listing them in a ul didn't look appealing enought , luckily i hda seen the tanstack website and their sponsors section wher they had this coool visualization of circles that vary in sizebased on how big a contributor they are..

We'll be using vlsx by the people at Airbnb

npm i @visx/hierarchy @visx/responsive 
@tigawanna
tigawanna / contact_me_form_server_actions.md
Created January 14, 2024 15:20
contact me form server actions in nextjs with nodemailer

Adding a contact me form using server actions and nodemailer

Now that we've shown the viewre all about us , lets give them a way to reach us

Since we're using NextJs lets use some server actions to send them an email when someone submits that form

Lets create the server action

"use server";
@tigawanna
tigawanna / github_javascript_stack.md
Created January 14, 2024 14:25
Aggregate a repos package json to determine their javascript stack
// deno-lint-ignore-file no-explicit-any ban-ts-comment

import { logError } from "../helpers.ts";
import { getViewerRepos, LanguageEdge } from "./getViewerRepos.ts";

export function pkgTypeCondition(pkg: RequiredDecodedPackageJson): {
  pkg_type: TPkgType;
  condition: boolean;
} {
@tigawanna
tigawanna / fetch_all_viewer_repos.md
Created January 14, 2024 14:21
Recursively fetch all github repositories and it's langauges

code to fetch the viewer's repos

export async function getViewerRepos(
  viewer_token: string,
  cursor: string | null = null,
): Promise<{ data: ViewerRepos | null; error: BadDataGitHubError | null }> {

  const query = `
    query($first: Int!,$after: String) {
@tigawanna
tigawanna / readme_o_website.md
Last active January 15, 2024 05:49
How to display your README in your project , how to load markdown string with codeblocks and theme it properly without tailwind overiding the styles

Adding a github readme markdown to website

Add the dependancies

 npm i showdown highlight.js
npm i -D @types/showdown
@tigawanna
tigawanna / marmot-pocketbase.md
Last active May 15, 2024 02:44
setting up marmot and pocketbase on linux with nats-server

Getting started with marmot and pocketbase

This will work with any sqlite db since the only pocketbase specifics are the pb_data/data.db sqlite file in pocketbase

installation


the most reliable source for the latest + other versions would is repo/releases

@tigawanna
tigawanna / pocketbase-nginx.md
Last active September 1, 2024 16:29
How to host pocketbase on linux with ngnix as a reverse proxy

Tips on linux vm hosting of pocketbase

- copy installer to machine

helper script

#!/usr/bin/env bash
# Transfers a file from local to remote
PATH_TO_FILE=$1
IP=$2
USERNAME=$3