Skip to content

Instantly share code, notes, and snippets.

View tigawanna's full-sized avatar

Dennis kinuthia tigawanna

  • Nairobi Kenya
View GitHub Profile

react-query tips and tricks i've found usefull while working with github's graphql api

using select to insert a new value into the response

import React from 'react'
import { useQuery } from 'react-query';
import { GraphQLClient } from 'graphql-request';
import { gql } from 'graphql-tag';
@tigawanna
tigawanna / nextjs-localstorage-hook.md
Created September 3, 2022 08:45
hook to read and write the local storage in NextJs

useLocalStorage the custom hook

strapped this together to help save and retrieve the user-theme and token from the localstorage

was working on a react vite app and had to port it over to Next Js the ported next js app and i very quickly discovered that localStorage worked a little differently n Nextjs and i need it because that's where i was saving my personal access token and theme preferences which lead me down a rabbit hole which resulted in the following custom hook for that

@tigawanna
tigawanna / github-graphql-api.md
Created September 3, 2022 08:46
working with Github's Graphql api

working with Github's Graphql api

After working with the github rest api and experiencing some of it's limitations it's time to pick things up a bit and dive into their Graphql api

as Usual first things first we set up a tesing enviroment and github provides their own explorer which will setup the authentication headers for you under the hood , but if you prefer to use another gql explorer , just set it up like below Replace ghp_LBgN6pCeWsHcxeoJpR4ZTwUj with your personal access token

Image description

I have another article i made about react-query tips an tricks which might help explain that part . becau

@tigawanna
tigawanna / followUser.md
Created September 3, 2022 10:47
how to follow a user in github graphql with react query

Graphql mutations

using the github graphql api with react-query

we'll use follow and unfollow user mutations it takes in parmeter

input:FollowUserInput|UnfollowUserInput

which has the fields

@tigawanna
tigawanna / vite_env_vars.md
Created September 5, 2022 15:50
adding vite enviromet variables : firebase api cnofig
  • create a .env file in the root directory
  VITE_apiKey=zahtddfrsfSyCHJYZaDa9s47oP4L7Cc
  VITE_authDomain=firebaseapp.firebaseapp.com
  VITE_databaseURL=https://firebaseapp.firebaseio.com
  VITE_projectId=firebaseapp
  VITE_storageBucket=firebaseapp.appspot.com
  VITE_messagingSenderId=200000020053535353535353535353
 VITE_appId=1:50000000080792:web:6676767676d766d7676sw6

how to completely remove MySql from linux

i had to do it after i forgot root password and the reset methods wouldn't work

run sudo su first then run

#!/usr/bin/env bash

service mysql stop
killall -KILL mysql mysqld_safe mysqld
apt-get --yes purge mysql-server mysql-client
@tigawanna
tigawanna / profile.json
Last active September 13, 2022 14:53
working windows terminal settings json with wsl2 ubuntu git and powershell custom profiles with custom wsl starting directories
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command": "paste",
"keys": "ctrl+v"
},
{
@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
@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 / 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