Skip to content

Instantly share code, notes, and snippets.

View omartell's full-sized avatar
🚀
Shipping

Oliver Martell Núñez omartell

🚀
Shipping
  • London, United Kingdom
View GitHub Profile
@pesterhazy
pesterhazy / indexeddb-problems.md
Last active May 27, 2024 07:40
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)

@roman01la
roman01la / clojurescript-repl-workflow.md
Last active October 22, 2022 12:07
ClojureScript REPL Workflow

ClojureScript REPL Workflow

Short write up on using REPL when developing UIs in ClojureScript.

Hot-reload on save or Eval in REPL?

Everyone's standard approach to hot-reloading is to use a tool (Figwheel or shadow-cljs) that reloads changed namespaces automatically. This works really well: you change the code, the tool picks up changed files, compiles namespaces and dependants, notifies REPL client which then pulls in compiled changes, and re-runs a function that re-renders UI.

The other approach is to use ClojureScript's REPL directly and rely only on eval from the editor. This more or less matches Clojure style workflow. This approach might be useful when you don't want tools overhead or hot-reloading becomes slow for you or you just used to this style of interactions. Also changing code doesn't always mean that you want to reload all the changes. On the other hand it is very easy to change a couple of top-level forms and forget to eval one of them.

@yogthos
yogthos / clojure-beginner.md
Last active July 15, 2024 20:45
Clojure beginner resources

Introductory resources

@joelkuiper
joelkuiper / Clojure.md
Last active April 29, 2020 14:43
Job Descriptions

We are looking to hire a skilled Clojure/ClojureScript developer to help build a new platform for medical knowledge. By applying Machine Learning and Natural Language Processing to medical literature, we aim to give experts the insights they need to make informed decisions.

The project is part of Doctor Evidence, a company based in Santa Monica, CA. At this moment a small team is working remotely (GMT+2, EU timezone) on this project as a full-time Research & Development effort.

You will work in a small team that will architect and build the next-generation of data science tools for Evidence Based Medicine and Health Technology Assessment. A good fit would be someone who can work quickly while still following best practices, who thrives on new technology, and has an avid interest in medical informatics and machine learning.

What we offer

  • Flexible work hours from the comfort of your home
@pesterhazy
pesterhazy / podcasts.md
Last active February 27, 2019 22:40
Personal podcast recommendations

Documentary

  • Serial - An in-depth investigation of a 1999 murder case. Spellbinding, very well produced. Season 2 is interesting but doesn't quite reach the same quality.

  • S-Town - A reporter investigates a criminal case in a small town in Georgia. As the story unfolds, the focus shifts in unexpected ways, to an examination of life in the town to the main person's biography. Extraordinary.

Fiction

@jmingtan
jmingtan / deps.edn
Created April 14, 2018 03:16
Clojure CLI setup with rebel-readline and cider middleware
{:aliases
{:dev {:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.2"}
org.clojure/tools.nrepl {:mvn/version "0.2.12"}
cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"}}
:main-opts ["-m" "repl"]}}}
@pesterhazy
pesterhazy / ripgrep-in-emacs.md
Last active July 19, 2024 16:05
Using ripgrep in Emacs using helm-ag (Spacemacs)

Why

Ripgrep is a fast search tool like grep. It's mostly a drop-in replacement for ag, also know as the Silver Searcher.

helm-ag is a fantastic package for Emacs that allows you to display search results in a buffer. You can also jump to locations of matches. Despite the name, helm-ag works with ripgrep (rg) as well as with ag.

How

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@pjstadig
pjstadig / core.clj
Created March 20, 2017 13:06
A little type hint hint
(ns typehint.core)
;; A little type hint hint...
(set! *warn-on-reflection* true)
;; There are two ways to type hint the return value of a function, but one is
;; (technically) wrong:
(defn ^String as-string0