Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Shelob9 / script.js
Last active February 20, 2025 15:09 — forked from spf13/script.js
Download all your Kindle books before Feb 26, 2025
// 1. Log in to your Amazon account
// 2. Go to your Content Library > Books - https://www.amazon.com/hz/mycd/digital-console/contentlist/booksAll/dateDsc/
// 3. Open your browser's Javascript console
// 4. For each page of books, paste this script into the console
(async function () {
// Close the notification if it appears
function closeNotification() {
const notifClose = document.querySelector("span#notification-close");
if (notifClose) {
@Shelob9
Shelob9 / script.js
Created February 20, 2025 15:08 — forked from spf13/script.js
Download all your Kindle books before Feb 26, 2025
// 1. Log in to your Amazon account
// 2. Go to your Content Library > Books - https://www.amazon.com/hz/mycd/digital-console/contentlist/booksAll/dateDsc/
// 3. Open your browser's Javascript console
// 4. For each page of books, paste this script into the console
(async function () {
// Close the notification if it appears
function closeNotification() {
const notifClose = document.querySelector("span#notification-close");
if (notifClose) {
const fs = require('fs');
function readFromEnd(filePath, chunkSize = 1024) {
const stats = fs.statSync(filePath);
let position = stats.size;
let buffer = '';
const lines = [];
const stream = fs.createReadStream(filePath, {
highWaterMark: chunkSize,
import { useState } from "react";
import useCreateTextImage from "./useCreateTextImage";
function App() {
const [text, setText] = useState<string>('');
const imgRef = useCreateTextImage(text, 'black', 'white', { width: 400, height: 200 });
return (
import React from 'react';
export function Td({id,children,className}){
return (
<td id={id} className={className ?? ''}>
{children}
</td>
)
}
export function Th({id,children,className}:{
<?php
/**
* Plugin name: Josh412
*/
add_filer( 'show_admin_bar', '__return_false' );
/**
* Category validation
*/
add_filter('pre_insert_term',function( $term, $taxonomy, $args){
$allowed_parents = [
@Shelob9
Shelob9 / blue.css
Created December 7, 2023 22:42
Tailwind CSS with links styled like links
@tailwind base;
@tailwind components;
@tailwind utilities;
a {
@apply underline text-blue-800 hover:text-blue-400 visited:text-purple-800
}
@Shelob9
Shelob9 / filter-wp-request.php
Last active February 26, 2025 09:15
Using pre_http_request filter to mock HTTP request responses in WordPress phpunit test https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-http.php#L240-L262
<?php
class Test extends TestCase {
public function test_function_that_makes_api_request(){
add_filter('pre_http_request', function(){
return [
'body' => [
'id' => 1,
],