Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
Getting after it

Ayooluwa ayoisaiah

💪
Getting after it
View GitHub Profile
View example-1.js
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 Dec 27, 2016
Hello World in React!
View helloworld.html
<!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 Dec 7, 2020
Find Mean, Median and Mode in Rust
View main.rs
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 Sep 8, 2020
Countdown timer in Golang
View timer.go
// Tutorial: https://freshman.tech/golang-timer/
package main
import (
"flag"
"fmt"
"os"
"time"
)
View cmd1.bash
npm install express cors body-parser dotenv stream-chat --save
View .env
// .env
STREAM_API_KEY=<your api key>
STREAM_APP_SECRET=<your app secret>
View server.js
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());
View cmd2.bash
npm install @auth0/auth0-spa-js
View 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,
View index.js
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>"}