Skip to content

Instantly share code, notes, and snippets.

View anthony-langford's full-sized avatar
:electron:

Anthony Langford anthony-langford

:electron:
View GitHub Profile
@anthony-langford
anthony-langford / hashmap.js
Created October 10, 2019 16:15
create a hash table
// Create a hash table
const hash = (key, size) => {
let hashedKey = 0;
for (let i = 0; i < key.length; i++) {
hashedKey += key.charCodeAt(i);
}
return hashedKey % size;
let ctx = new AudioContext();
let osc = ctx.createOscillator();
osc.connect(ctx.destination);
osc.start();
window.onmousemove = event => {
document.body.style.backgroundColor = `hsl(${event.clientX}, 60%, 60%)`;
import React, { useState, useEffect } from "react";
import "./App.css";
let useRedditImages = (query) => {
let [images, setImages] = useState([])
useEffect(() =>
fetch(
`https://www.reddit.com/r/aww/search.json?q=${
query
}&restrict_sr=1`
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>