Skip to content

Instantly share code, notes, and snippets.

View dagalti's full-sized avatar
🎯
Focusing

dagalti

🎯
Focusing
View GitHub Profile
@afsalrahim
afsalrahim / php_bbcode_parser.php
Last active April 16, 2024 12:18
A simple PHP BBCode Parser function
<?php
/**
* A simple PHP BBCode Parser function
*
* @author Afsal Rahim
* @link http://digitcodes.com/create-simple-php-bbcode-parser-function/
**/
//BBCode Parser function
@TalAter
TalAter / idb.js
Created September 13, 2016 10:49
IndexedDB upgrade code to add index to an existing object store
request.onupgradeneeded = function(event) {
var db = event.target.result;
var upgradeTransaction = event.target.transaction;
var objectStore;
if (!db.objectStoreNames.contains("my-store")) {
objectStore = db.createObjectStore("my-store");
} else {
objectStore = upgradeTransaction.objectStore('my-store');
}
@LucasIron
LucasIron / debounce_throttle.js
Last active January 21, 2021 19:04
Debounce & Throttle
debounce = (delay, cancel) => (listener, wait) => {
let delayId
return function(...args) {
cancel(delayId)
return delayId = delay(() => listener.apply(this, args), wait)
}
}
debounceTimeout = debounce(setTimeout, clearTimeout)
debounceAnimationFrame = debounce(requestAnimationFrame, cancelAnimationFrame)