Skip to content

Instantly share code, notes, and snippets.

View Ridermansb's full-sized avatar
🤔
Always thoughtful

Riderman de Sousa Barbosa Ridermansb

🤔
Always thoughtful
View GitHub Profile
import {assert} from 'chai';
export namespace Dictionaries {
/**
* Create a deep copy of a dictionary such that all of the origina keys are maintained
* and copied into a new dictionary.
*
* This is used when we have to create a copy of a dictionary to prevent concurrent mutation
* or when we need to copy it and then make changes to the new dictionary.
@Ridermansb
Ridermansb / RingBuffer.ts
Last active July 5, 2021 12:00 — forked from burtonator/RingBuffer.ts
ring buffer...
import {assert} from 'chai';
/**
* Implement a class named ring buffer with fixed capacity such that
*
* constructor: takes the capacity for the ring buffer
*
* push: adds a value to the ring buffer.
* pop: removes the last value from the ring buffer or undefined if it's empty.
* peek: returns the current value of the most recent value added or undefined if none have been added
@Ridermansb
Ridermansb / useLocalStorageState.ts
Last active July 5, 2021 11:52 — forked from burtonator/useLocalStorageState.ts
useLocalStorageState.ts
import React from 'react';
/**
* Implement a replacement for useState which keeps values in the localStorage.
*
* The idea here is that all calls to use useState can be replaced with
* useLocalStorageState(key, initialValue) and implement the same behavior.
*
* The first time useLocalStorageState is called the value will be initialValue
* because nothing is stored in localStorage.
@Ridermansb
Ridermansb / keybase.md
Created July 12, 2020 16:07
keybase.md

Keybase proof

I hereby claim:

  • I am ridermansb on github.
  • I am ridermansb (https://keybase.io/ridermansb) on keybase.
  • I have a public key ASCOlNKyssaiZgrJwj7ZcnQJEHd204hSxx3XPCcJqhAllAo

To claim this, I am signing this object:

@Ridermansb
Ridermansb / github_user_repos.js
Created October 3, 2017 11:38
WebTask Github Proxy
/* eslint-disable import/no-extraneous-dependencies */
/**
* Make request to Github API to get all repositories
* Headers: { Authorization: Bearer <AUTH0 USER API TOKEN> }
*
* On WebTask
* Secrets required:
* 1. auth0_domain - Auth0 Client Domain
* 2. client_id
@Ridermansb
Ridermansb / taskgit
Last active August 29, 2015 14:27 — forked from unode/taskgit
#!/bin/sh
# copyright 2014 Renato Alves
# distributed under the GPL licence
if [ -z "$TASKDIR" ]; then
#TODO Look for data location in rc:location instead of assuming ~/.taskrc
TASKDIR="$(grep data.location $HOME/.taskrc | cut -d '=' -f 2)"
fi
@Ridermansb
Ridermansb / .gitignore
Last active May 5, 2021 22:26
Boxstarter script
*.sublime*