Consider a list of strings you need to permanently assign a random color.
First you should turn the string into a hash.
var string = "string"
var hash = 0| "use client"; | |
| import { | |
| type ColumnDef, | |
| flexRender, | |
| getCoreRowModel, | |
| useReactTable, | |
| getPaginationRowModel, | |
| getSortedRowModel, | |
| getFilteredRowModel, |
| // from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/ | |
| function bytesToSize(bytes) { | |
| var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; | |
| if (bytes == 0) return 'n/a'; | |
| var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); | |
| if (i == 0) return bytes + ' ' + sizes[i]; | |
| return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i]; | |
| }; | |
| const getBase64StringSizeInbites = string => { |
HoloISO is more straightforward to install and is being actively worked on.
This is an unofficial short guide on running Steam Decks new UI on Manjaro. I am kind of a linux noob, so forgive me if I get a few things wrong in this guide. Also, I have not fully tested everything so there may be some weird issues that I have overlooked.
| IMAGE_SRC = './img/8.jpg' | |
| const loadImage = () => { | |
| const img = new Image() | |
| img.src = IMAGE_SRC | |
| const canvas = document.querySelector('canvas') | |
| const ctx = canvas.getContext('2d') | |
| img.addEventListener('load', () => { |
| const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); | |
| const pixels = imageData.data; | |
| for (let i = 3, n = canvas.width * canvas.height * 4; i < n; i += 4) { | |
| pixels[i] = pixels[i] < 127? 0 : 255 | |
| } | |
| ctx.putImageData(imageData, 0, 0); |
Quick demo showing how to get a Base64-encoded thumbnail.png file from a gist.
Thumbnails are very handy visual indicators of the content of a block on bl.ocks.org, esp for rapidly surveying a user's collection.
However, many block creators don't add thumbnails because of the extra steps involved in adding them to a gist. Since the gist API doesn't let you upload binaries you end up having to clone you're gist to add a thumbnail. Note: @mbostock's gist to clone all gists is useful here.
It's been suggested that the gist-img shell script enables you to upload thumbnail images. That's at least half true. It automates the base64 encoding of png images prior to upload with @defunkt's gist CLI tool, so you end up u
It was not exactly obvious. Here's how to revert a Gist commit!
Checkout the gist like a normal git repo:
# replace the Gist ID with your own
git clone [email protected]:cc13e0fcf2c348cc126f918e4a3917eb.git
Treat it like a normal repo. Edit, force push, etc.
| // Add any other logic here as needed. | |
| import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin'; | |
| import { CacheFirst } from 'workbox-strategies/CacheFirst'; | |
| import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL'; | |
| import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin'; | |
| import { NavigationRoute } from 'workbox-routing/NavigationRoute'; | |
| import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute'; | |
| import { registerRoute } from 'workbox-routing/registerRoute'; |
| define(function(require, exports, module) { | |
| "use strict"; | |
| var oop = require("../lib/oop"); | |
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
| var MyNewHighlightRules = function() { | |
| this.$rules = { | |
| "start" : [ |