Skip to content

Instantly share code, notes, and snippets.

View Toyurc's full-sized avatar
🏠
........Working

Adebayo-Ige Omotoyosi Toyurc

🏠
........Working
View GitHub Profile
@lilpolymath
lilpolymath / LRUCache.md
Created April 12, 2022 14:30
Implementing a given cache size behaving as an LRU cache with an expiry time and auto cache burst

Question

Implement Promise based memoization with a given cache size behaving as an LRU cache with an expiry time and auto cache burst.

Answer

First, what we have to do is breakdown the terms in the problem statement to understand what is going on and what we are asked to do.

  1. Promise based memoization: Memoization is one of the ways we can improve the performance of functions by eliminating redundant calls. Memoization is a technique where we store the results of a function call in a cache and return the result from the cache if the function is called again with the same arguments.
@FlorianRappl
FlorianRappl / useCarousel.ts
Last active March 27, 2024 13:58
The generic useCarousel hook.
import { useReducer, useEffect } from 'react';
import { useSwipeable, SwipeableHandlers, EventData } from 'react-swipeable';
function previous(length: number, current: number) {
return (current - 1 + length) % length;
}
function next(length: number, current: number) {
return (current + 1) % length;
}
@jakubigla
jakubigla / Dockerfile
Created December 10, 2018 14:36
Dockerfile for multistage build of spring boot application using maven with SonarQube and proxy support
ARG BUILD_IMAGE=maven:3.5-jdk-11
ARG RUNTIME_IMAGE=openjdk:11-jdk-slim
#############################################################################################
### Stage where Docker is pulling all maven dependencies ###
#############################################################################################
FROM ${BUILD_IMAGE} as dependencies
ARG PROXY_SET=false
ARG PROXY_HOST=
import axios from 'axios'
import config from '../config'
import {getUserIdToken} from './auth'
const axiosInstance = axios.create({
baseURL: config.api[process.env.NODE_ENV].base + config.api[process.env.NODE_ENV].graphqlEndpoint,
timeout: 5000
})
{
"stylelint.enable": true,
"css.validate": false,
"scss.validate": false
}
@stephanbogner
stephanbogner / index.html
Created November 8, 2017 14:49
Simple example of using javascript to take a photo from a website
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Camera</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style type="text/css">
.cameraRoll {
@paramaggarwal
paramaggarwal / razzle.config.js
Created October 26, 2017 15:10
Razzle config with support for SASS (with source maps)
"use strict";
const autoprefixer = require("autoprefixer");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const Visualizer = require("webpack-visualizer-plugin");
module.exports = {
modify: (baseConfig, { target, dev }, webpack) => {
const appConfig = Object.assign({}, baseConfig);
@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active July 10, 2024 16:57
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@mofesolapaul
mofesolapaul / nigeria-states.json
Last active June 29, 2024 12:55
List of all Nigerian states, alphabetically arranged in JSON array
[
"Abia",
"Adamawa",
"Akwa Ibom",
"Anambra",
"Bauchi",
"Bayelsa",
"Benue",
"Borno",
"Cross River",
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active July 12, 2024 21:08
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub