Skip to content

Instantly share code, notes, and snippets.

View ayoisaiah's full-sized avatar
💪
Getting after it

Ayooluwa Isaiah ayoisaiah

💪
Getting after it
View GitHub Profile
for (var k = 0; k < 5; k++) {
console.log(k); // 0, 1, 2, 3, 4
}
console.log(k); //5 because k is global
@ayoisaiah
ayoisaiah / helloworld.html
Created December 27, 2016 08:56
Hello World in React!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Hello World!</title>
</head>
<body>
<main id="app">
@ayoisaiah
ayoisaiah / main.rs
Last active January 30, 2023 12:30
Find Mean, Median and Mode in Rust
use std::collections::HashMap;
fn mean(numbers: &Vec<i32>) -> f32 {
let sum: i32 = numbers.iter().sum();
sum as f32 / numbers.len() as f32
}
@ayoisaiah
ayoisaiah / timer.go
Last active August 8, 2022 13:26
Countdown timer in Golang
// Tutorial: https://freshman.tech/golang-timer/
package main
import (
"flag"
"fmt"
"os"
"time"
)
npm install express cors body-parser dotenv stream-chat --save
// .env
STREAM_API_KEY=<your api key>
STREAM_APP_SECRET=<your app secret>
require('dotenv').config();
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const { StreamChat } = require('stream-chat');
const app = express();
app.use(cors());
npm install @auth0/auth0-spa-js
@ayoisaiah
ayoisaiah / auth0.js
Last active January 6, 2020 21:02
auth0.js
import React, { useState, useEffect, useContext } from 'react';
import createAuth0Client from '@auth0/auth0-spa-js';
const DEFAULT_REDIRECT_CALLBACK = () =>
window.history.replaceState({}, document.title, window.location.pathname);
export const Auth0Context = React.createContext();
export const useAuth0 = () => useContext(Auth0Context);
export const Auth0Provider = ({
children,
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { Auth0Provider } from './auth0';
ReactDOM.render(
<Auth0Provider
domain={"<your domain>"}
client_id={"<your client id>"}