Skip to content

Instantly share code, notes, and snippets.

@jabis
jabis / gun.helper.js
Last active July 15, 2023 10:48
Gun user-space and public graph get/set with signing and encryption
/**
* get and put encrypted and/or signed material to paths in Gun
* FIXME: Investigate why root level put doesn't work
*
* DONE: Add signing to make objects unwritable by others
* Changes:
* - 25.02.2020
* - added mergedeep to better merge deeper objects between themselves
* - added pair.osign option to only sign not encrypt when passing existing pairs
**/
@todofixthis
todofixthis / bootstrap.toggleModal.js
Created October 22, 2016 19:08
Shows/Hides a Bootstrap 3 modal and returns a Promise object.
/** Shows or hides a Bootstrap 3 modal and returns a Promise object.
*
* Bootstrap's modal functions return before the modal is shown/
* hidden, which can cause glitches if subsequent code doesn't
* expect that.
*
* Unfortunately, there is no built-in way to defer an
* operation until after the modal is shown/hidden, so
* this function does a little monkey-patching to make
* it work.
@SleepWalker
SleepWalker / swipe.js
Created September 30, 2015 04:59
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.screenX;
touchstartY = event.screenY;