Skip to content

Instantly share code, notes, and snippets.

View nixbytes's full-sized avatar
⚙️
I shall know the kernel, and through understanding, command it.

0xhexbytes nixbytes

⚙️
I shall know the kernel, and through understanding, command it.
View GitHub Profile
@nixbytes
nixbytes / memoize.py
Created October 31, 2021 16:35
Memoization, or caching, is an incredibly important feature of any highly-performant system.
''''
When the function is called, we'll create a hashable key from the supplied arguments by freezing
the positional arguments and the keyword arguments, hoping that the arguments themselves are hashable.
If we haven't seen these arguments before, we'll compute the result and store it in the cache. Then, we'll
return the result from the cache. This way, if the function is called multiple times with the same arguments,
each invocation after the first will only use the value from cache, and won't recompute the function.
'''
import functools
@nixbytes
nixbytes / perf.js
Created November 21, 2019 01:54
javascript performance testing
const startingTime = performance.now();
for (let i = 1; i <= 100; i++) {
for (let j = 1; j <= 100; j++) {
console.log('i and j are ', i, j);
}
}
const endingTime = performance.now();
console.log('This code took ' + (endingTime - startingTime) + ' milliseconds.');
@nixbytes
nixbytes / index.html
Created November 21, 2019 01:50
Pop Up Icons
<center><ul class="pop-up">
<li><svg width="54" height="54" viewBox="0 0 24 24">
<path d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"></path>
</svg></li>
<li><svg width="54" height="54" viewBox="0 0 24 24">
<path d="M11.83,1.73C8.43,1.79 6.23,3.32 6.23,3.32C5.95,3.5 5.88,3.91 6.07,4.19C6.27,4.5 6.66,4.55 6.96,4.34C6.96,4.34 11.27,1.15 17.46,4.38C17.75,4.55 18.14,4.45 18.31,4.15C18.5,3.85 18.37,3.47 18.03,3.28C16.36,2.4 14.78,1.96 13.36,1.8C12.83,1.74 12.32,1.72 11.83,1.73M12.22,4.34C6.26,4.26 3.41,9.05 3.41,9.05C3.22,9.34 3.3,9.72 3.58,9.91C3.87,10.1 4.26,10 4.5,9.68C4.5,9.68 6.92,5.5 12.2,5.59C17.5,5.66 19.82,9.65 19.82,9.65C20,9.94 20.38,10.04 20.68,9.87C21,9.69 21.07,9.31 20.9,9C20.9,9 18.15,4.42 12.22,4.34M11.5,6.82C9.82,6.94 8.21,7.55 7,8.56C4.62,10.53 3.1,14.14 4.77,19C4.88,19.33 5.24,19.5 5.57,19.39C5.89,19.28 6.07,18.92 5.95,18.6V18.6C4.41,14.13 5.78,11.2 7.8,9.5C9.77,7.89 13.25,7.5 15.84,9.1C17.11,9.9 18.1
@nixbytes
nixbytes / css-audio-playing-animation.markdown
Last active November 21, 2019 01:51
CSS Audio playing animation