Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
pesterhazy / building-sync-systems.md
Last active April 16, 2025 11:29
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@mmontone
mmontone / quicksearch.el
Last active May 7, 2021 13:39
Emacs/SLIME frontend to Quicksearch, a search-engine-interface for Common Lisp.
;; Copyright (C) 2021 Mariano Montone
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@dangom
dangom / org-roam-weeklies.el
Created February 4, 2021 03:43
Weekly notes for org-roam
;;; org-roam-weeklies.el --- Weekly-notes for Org-roam -*- coding: utf-8; lexical-binding: t; -*-
;;;
;; Copyright © 2020 Jethro Kuan <[email protected]>
;; Copyright © 2020 Leo Vivier <[email protected]>
;; Author: Jethro Kuan <[email protected]>
;; Leo Vivier <[email protected]>
;; URL: https://github.com/org-roam/org-roam
;; Keywords: org-mode, roam, convenience
;; Version: 1.2.3
@purcell
purcell / taskqueues.sql
Last active March 19, 2021 08:35
Easy task queues using PostgreSQL
-- Let's say you have a table full of work:
CREATE TABLE tasks (
id UUID PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
status TEXT NOT NULL DEFAULT 'pending',
payload JSON NOT NULL, -- or just have meaningful columns!
created_at TIMESTAMP NOT NULL DEFAULT NOW()
);
@purcell
purcell / migrations.sql
Last active September 16, 2017 10:10
PostgreSQL schema migrations system
This code now lives in its own repo at https://github.com/purcell/postgresql-migrations
@mrkgnao
mrkgnao / IosevkaConfigGen.hs
Last active February 25, 2025 07:23
Render Iosevka ligatures to Private Use Area glyphs, for Emacs
{-# LANGUAGE RecordWildCards, Arrows #-}
import Numeric
import Data.Char
import Control.Monad
import Data.Monoid ((<>))
import Data.List (nub, sort, reverse)
data RepeatBounds = RB
@paulirish
paulirish / what-forces-layout.md
Last active April 17, 2025 05:10
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@webcss
webcss / eventsmixin.js
Last active August 9, 2016 12:44
PubSub mixin using CustomEvents
// utilizes the browser eventsystem
// usefull in cases where you need communication between independent components
// registered events are automatically removed onunload with preserving any other onunload handler
var eventsMixin = function(target) {
var _subscriptions = [];
target.broadcast = function(type, payload) {
var ev = new CustomEvent(type, {
detail: payload,
@webcss
webcss / mithril-touch.js
Last active May 26, 2020 15:34
mithril-touch, consume touch and mouse events evenly with mithril
/*****************************************
/* DOM touch support module
/*****************************************/
if (!window.CustomEvent) {
window.CustomEvent = function (event, params) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};
@corny
corny / git.cap
Created November 14, 2013 01:31
Capistrano 3 with Git Submodules
# Save this file as lib/capistrano/tasks/git.cap
namespace :git do
desc 'Copy repo to releases'
task create_release: :'git:update' do
on roles(:all) do
with fetch(:git_environmental_variables) do
within repo_path do
execute :git, :clone, '-b', fetch(:branch), '--recursive', '.', release_path
end