Skip to content

Instantly share code, notes, and snippets.

View maddyonline's full-sized avatar
🌴
On vacation

Madhav Jha maddyonline

🌴
On vacation
View GitHub Profile
# STEP 1: Load
# Load documents using LangChain's DocumentLoaders
# This is from https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/csv.html
from langchain.document_loaders.csv_loader import CSVLoader
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv')
data = loader.load()
@maddyonline
maddyonline / 00-README-NEXT-SPA.md
Created March 18, 2023 07:37 — forked from gaearon/00-README-NEXT-SPA.md
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Building

@maddyonline
maddyonline / auto-play-slideshow-react.markdown
Created October 28, 2021 05:32
Auto-Play Slideshow React
@maddyonline
maddyonline / duplicate-a-starter-project.md
Last active January 18, 2021 00:00
zero-to-launch-divjoy

Starting a Divjoy project

First of all this section is only for the paid users of Divjoy project users. While you are most certainly welcome to go ahead and download a starter template from Divjoy, the following steps show our version of the template which is only slightly modified so it works out of the box and can be deployed readily on Vercel.

Steps to clone a starter project

We will use a mirror clone of a bare project to clone a private repo to your own project.

git clone --bare https://github.com/onweb-city/divjoy-bootstrap-starter.git
@maddyonline
maddyonline / gist_markdown_examples.md
Last active January 12, 2021 07:32 — forked from ww9/gist_markdown_examples.md
Gist markdown examples

Gist markdown examples

A collection of Markdown code and tricks that were tested to work in Gist.

This and all public gists in https://gist.github.com/ww9 are Public Domain. Do whatever you want with it including , no need to credit me.

Cool
Routing

@maddyonline
maddyonline / readme.md
Created January 12, 2021 07:31 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

@maddyonline
maddyonline / bcrypt.go
Created January 11, 2021 20:26 — forked from somersbmatthews/bcrypt.go
bcrypt hashing functions #bcrypt #go
func hashAndSalt(pwd []byte) string {
hash, err := bcrypt.GenerateFromPassword(pwd, bcrypt.MinCost)
if err != nil {
log.Println(err)
}
return string(hash)
}
func comparePasswords(hashedPassword string, plainPassword []byte) bool {
@maddyonline
maddyonline / index.html
Created December 3, 2019 01:54
Vue Pomodoro Timer Scotch Challenge Main
<!-- our template -->
<section id="app" class="hero is-info is-fullheight is-bold">
<div class="hero-body">
<div class="container has-text-centered">
<h2 class="title is-6">{{title}}</h2>
<div id="timer">
<span id="minutes">{{ minutes }}</span>
<span id="middle">:</span>
@maddyonline
maddyonline / machine.js
Created November 12, 2019 03:04
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@maddyonline
maddyonline / machine.js
Last active November 12, 2019 02:54
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions