Convert Hugo articles to Embendding for Cloudflare Vectorize Store
The single.json
is a example to add JSON outptu for your theme.
Setup a new config ai.toml
to extend output
// Example showing how to download large objects from S3 and cache using IndexedDB | |
// Once downloaded, all future requests for the file are automatically served from IndexedDB. | |
// Offline caching module - | |
import Dexie from 'dexie'; | |
import axios from 'axios'; | |
const db = new Dexie('offline-blobs'); | |
db.version(1).stores({ | |
blobs: 'key,id, blob' |
If you've written any kind of validation on user input, like onkeypress
then you'll know that sometimes you want to throttle the amount of times your function runs. A good example of this is Ajax based username validation - you don't want to hit the server on every key press, because most users will be able to write their name in around 1/10th of a second, so you should throttle the ajax request until the input is dormant for 100ms.
So with a bit of magic JavaScript making use of the ever useful closure JavaScript offers, we can create a simple method to handle this for us:
function debounce(fn, delay) {
var timer = null;
return function () {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
use std::str; | |
fn main() { | |
// -- FROM: vec of chars -- | |
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}']; | |
// to String | |
let string1: String = src1.iter().collect::<String>(); | |
// to str | |
let str1: &str = &src1.iter().collect::<String>(); | |
// to vec of byte |
Prevent creation of vmmem files in VMware (Windows)
VMWare creates .vmem
files to back the guest RAM. On the host this causes disk thrashing especially during powering on and off the guest.
Add the following lines to the .vmx
file to prevent creation of .vmem
files. This will reduce disk IO and VM performance will improve especially on non-SSD disks.
export default [ | |
"Reticulating splines...", | |
"Generating witty dialog...", | |
"Swapping time and space...", | |
"Spinning violently around the y-axis...", | |
"Tokenizing real life...", | |
"Bending the spoon...", | |
"Filtering morale...", | |
"Don't think of purple hippos...", | |
"We need a new fuse...", |
@include keyframe(fadeout) { | |
0% { | |
opacity: 1; | |
} | |
100% { | |
opacity: 0; | |
} | |
} |