Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
pesterhazy / indexeddb-problems.md
Last active August 5, 2024 16:08
The pain and anguish of using IndexedDB: problems, bugs and oddities

This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).

Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.

Backing file on disk (WAL file) keeps growing (Safari)

When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.

Random exceptions when working with a large number of indexeddb databases (Safari)

@meduzen
meduzen / laravel-medialibrary-ffmpeg-settings-for-macos-and-ubuntu.md
Created February 17, 2020 10:35
Having FFMpeg working on Ubutu or macOS for Spatie Media Library

Spatie’s Media Library requires FFmpeg in order to create video poster images.

Install FFmpeg

  • sudo apt update;
  • sudo apt install ffmpeg;
  • ffmpeg -version should output FFmpeg version.
@adtac
adtac / README.md
Last active August 5, 2024 16:07
Using your Kindle as an e-ink monitor

using your Kindle as an e-ink monitor

demo: https://x.com/adtac_/status/1820127470613622950 (3.5 fps, Paperwhite 3)

step 1: jailbreak your Kindle

mobileread.com is your best resource here, follow the instructions from the LanguageBreak thread

I didn't really follow the LanguageBreak instructions because I didn't care about most of the features + I was curious to do it myself, but the LanguageBreak github repo was invaluable for debugging

// MARK: - Encoding
public struct <#Name#>Encoder: Encoder {
public let codingPath: [CodingKey]
public var userInfo: [CodingUserInfoKey: Any]
public func container<Key: CodingKey>(keyedBy type: Key.Type) -> Swift.KeyedEncodingContainer<Key> {
<#code#>
}
@nepsilon
nepsilon / how-to-git-patch-diff.md
Last active August 5, 2024 16:06
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff &gt; some-changes.patch
@Stylesproline
Stylesproline / README.md
Created December 9, 2021 07:53
Awesome-Selfhosted
@rdakar
rdakar / Validação de CPF e CNPJ - C#
Created August 14, 2017 21:02
Validação de CPF e CNPJ - C#
namespace CpfCnpj
{
public static class CpfCnpjUtils
{
public static bool IsValid(string cpfCnpj)
{
return (IsCpf(cpfCnpj) || IsCnpj(cpfCnpj));
}
private static bool IsCpf(string cpf)
@chaance
chaance / use-prompt.jsx
Last active August 5, 2024 16:04
Example implementation of `usePrompt` and React Router v5's `<Prompt>` with `unstable_useBlocker`
/**
* ------------------------------------------------------------------------------
* IMPORTANT UPDATE:
* This is *not* a complete implementation and I do not suggest using it!. This
* was primarily an experiment to determine whether or not a decent blocking
* hook could be implemented in userland, and the answer we came up with is NO.
*
* Luckily we added `usePrompt` (behind an `unstable_` flag) back to React Router
* a few versions ago! It's not documented [and I'm no longer on the team, so I
* probably won't try to do anything about that], but you can see it in source.
@jjb
jjb / file.md
Last active August 5, 2024 16:03
Using Jemalloc 5 with Ruby.md

For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.

Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.

Ubuntu/Debian

FROM ruby:3.1.2-bullseye
RUN apt-get update ; \