This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from 'react'; | |
import localforage from 'localforage'; | |
const SIX_HOURS_IN_MILLISECONDS = 21600000; | |
type CacheOptions = { | |
expireAtMilliseconds?: number; | |
}; | |
type CachedItem = { | |
key: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The diamond kata takes as its input a letter, and outputs it in a diamond shape. Given a letter, it prints a diamond starting with 'A', with the supplied letter at the widest point. | |
Requirements | |
The first row contains one 'A'. | |
The last row contains one 'A'. | |
All rows, except the first and last, have exactly two identical letters. | |
All rows have as many trailing spaces as leading spaces. (This might be 0). | |
The diamond is horizontally symmetric. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def isPalindrome(self, user_supplied_integer): | |
""" | |
In order to avoid string conversion, the algorithm hinges on some math tricks. But it | |
prevents the inevitable O(n) of int-to-string conversion. Instead we can do what we | |
need to in O(n/2), though this is often expressed as O(n), it is still better! | |
Let's say your function is given the following int argument: 35753 | |
First, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
* Compilation: javac Evaluate.java | |
* Execution: java Evaluate | |
* Dependencies: Stack.java | |
* | |
* Evaluates (fully parenthesized) arithmetic expressions using | |
* Dijkstra's two-stack algorithm. | |
* | |
* % java Evaluate | |
* ( 1 + ( ( 2 + 3 ) * ( 4 * 5 ) ) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* HTTP over TLS (HTTPS) example sketch | |
* | |
* This example demonstrates how to use | |
* WiFiClientSecure class to access HTTPS API. | |
* We fetch and display the status of | |
* esp8266/Arduino project continuous integration | |
* build. | |
* | |
* Limitations: |