Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
pesterhazy / building-sync-systems.md
Last active November 15, 2024 10:17
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

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2016 Matt Menzenski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@vitorgalvao
vitorgalvao / Right Click.applescript
Last active March 16, 2023 14:30
Make right-clicking on OSX accessible via a keyboard shortcut
(*
A [native solution][1] exists but it suffers from a major flaw: it right-clicks where the cursor is, not what on the selection.
This code addresses that limitation, though it only works on Finder windows and not the Desktop.
You can install it as a [Finder Service, and later asign it a keyboard shortcut][2].
[1]: http://stackoverflow.com/questions/9171613/right-click-shortcut-for-mac-lion-os
[2]: http://www.macosxautomation.com/services/learn/tut01/index.html
*)
@artnez
artnez / monkey-patch
Created May 6, 2013 04:15
Monkey patching a function in bash.
#! /usr/bin/env bash
#
# Monkey patching a function in bash. Why.
patch() {
new_guy=$(declare -f $1)
new_guy=${new_guy##$1*\{}
new_guy=${new_guy/\}/}
old_guy=$(declare -f $2)
old_guy=${old_guy/$2*{/}
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@yurial
yurial / git-rebase--interactive.patch
Created February 25, 2012 16:29
show author on rebase
fix:
/usr/libexec/git-core/git-rebase--interactive
-git rev-list $merges_option --pretty=oneline --abbrev-commit\
+git rev-list $merges_option --pretty=">%h (%an <%ae>) %s"\
result:
1 pick 19f43c1 (Yuri Dyachenko <[email protected]>) add: gcrypt::noerr
2 pick 990a7e8 (Yuri Dyachenko <[email protected]>) add: gcrypt::throwif( err ) throw if err != noerr
3 pick cb03f3b (Yuri Dyachenko <[email protected]>) add: ext::move<T> move semantic