Skip to content

Instantly share code, notes, and snippets.

View onedebos's full-sized avatar

Adebola Adeniran onedebos

View GitHub Profile
@onedebos
onedebos / UKSA document list.json
Created August 4, 2025 14:21
Document requirements for Schengen visa in the UK
const VISA_REQUIREMENTS = {
austria: "",
belgium: "",
"czech republic": "",
denmark:
"https://storbritannien.um.dk/en/travel-and-residence/how-to-apply-for-a-visa/visa-checklists",
estonia: "",
finland: "",
france: "",
germany: "",
import Footer from '../../components/Footer';
import axios from 'axios';
import parse from 'html-react-parser';
import { getAuthor, getFeaturedImage } from '../../lib/utils';
import { POSTS_API_URL } from '../../lib/constants';
import Head from 'next/head';
import styles from '../../styles/Post.module.css';
export default function Post({ title, featuredImg, author, content, date }) {
return (
<div className="flex flex-col items-center justify-center min-h-screen">
import Footer from '../../components/Footer';
import axios from 'axios';
import { getAuthor, getFeaturedImage } from '../../lib/utils';
import { POSTS_API_URL } from '../../lib/constants';
export default function Post({ title, featuredImg, author, content, date }) {
return (
<div className="flex flex-col items-center justify-center min-h-screen">
</div>
import Link from 'next/link';
import { useState, useEffect } from 'react';
import { getAuthor, getFeaturedImage } from '../lib/utils';
import parse from 'html-react-parser';
export default function Post({ post }) {
const [postImgAndAuthor, setPostImgAndAuthor] = useState({ featImgUrl: '', author: '' });
useEffect(() => {
let mounted = true;
if (mounted) {
const author = getAuthor(post.author);
import Head from 'next/head';
import Post from '../components/Post';
import Footer from '../components/Footer';
import { useState, useEffect } from 'react';
import { getAllPostsFromServer } from '../lib/utils';
export default function Home() {
const [posts, setPosts] = useState([]);
useEffect(async () => {
@onedebos
onedebos / utils.js
Created April 28, 2021 22:56
methods that handle getting the post, author and featured image from our server
import axios from 'axios';
import { POSTS_API_URL, AUTHORS_API_URL, MEDIA_API_URL } from './constants';
export const getAllPostsFromServer = async () => {
// get all posts from Server
try {
const { data } = await axios.get(POSTS_API_URL);
return data;
} catch (error) {
import { pusher } from "../../../lib/pusher";
// presence channel handler
export default async function handler(req, res) {
const { message, username, userLocation } = req.body;
// trigger a new post event via pusher
await pusher.trigger("presence-channel", "chat-update", {
message,
username,
userLocation
import pusher from './index'
export default function handler({ req, res }) {
// trigger a new post event via pusher
pusher.trigger("presence-channel", "location-update", {
username: req.body.userName,
location: req.body.location,
});
res.json({ status: 200 });
@onedebos
onedebos / auth.js
Last active March 12, 2021 01:55
pages/api/pusher/auth.js
import {pusher} from '../../../../lib/pusher'
export default async function handler( req, res ) {
// see https://pusher.com/docs/channels/server_api/authenticating-users
const { socket_id, channel_name, username, userLocation } = req.body;
// use JWTs here to authenticate users before continuing
const randomString = Math.random().toString(36).slice(2);
import { useEffect, useState } from "react";
import Pusher from "pusher-js";
import axios from "axios";
const Chat = ({ sender }) => {
const [chats, setChats] = useState([]);
const [messageToSend, setMessageToSend] = useState("");
useEffect(() => {
const pusher = new Pusher(process.env.NEXT_PUBLIC_KEY, {