Skip to content

Instantly share code, notes, and snippets.

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

Boluwatife Adekola-Ojo ojknation

🏠
Working from home
View GitHub Profile
@ojknation
ojknation / cnn_lstm.ipynb
Created December 4, 2023 00:52
CNN_LSTM.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ojknation
ojknation / api.js
Last active September 6, 2023 18:45
React Query infinite query
// the pageParam variable is very important, it is destructured from the object react query sends as a parameter to
//apiFunction, pageParam contains the current page number value which is key to the infinite query pattern
export const apiFunction = async ({ queryKey, pageParam }) => {
const [, params] = queryKey;
const { type, status, search, id } = params;
// sample params
import html2canvas from "html2canvas";
import { jsPDF } from "jspdf";
const PDFDownload = () => {
const ref = React.createRef();
const handleDownloadPdf = async () => {
const element = ref.current;
const canvas = await html2canvas(element, {
@ojknation
ojknation / WorkoutContext.jsx
Created October 14, 2022 16:51
React context with useReducer Example
import { createContext, useReducer } from "react";
export const WorkoutsContext = createContext();
const workoutsReducer = (state, action) => {
switch (action.type) {
case "SET_WORKOUTS":
return {
workouts: action.payload,
};