Skip to content

Instantly share code, notes, and snippets.


Christian Bonato bonatoc

View GitHub Profile
Matt-Jensen / Firebase Local Storage IndexedDb Dump.js
Created Feb 17, 2020
Access your Firebase Auth Token by dumping your IndexedDB session
View Firebase Local Storage IndexedDb Dump.js
(() => {
const asyncForEach = (array, callback, done) => {
const runAndWait = i => {
if (i === array.length) return done();
return callback(array[i], () => runAndWait(i + 1));
return runAndWait(0);
const dump = {};
Rich-Harris /
Last active Nov 25, 2021
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

paulirish /
Last active Nov 29, 2021
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
davisford / .bowerrc
Last active Nov 11, 2020
Updated build system for Ionic Framework
View .bowerrc
"directory": "bower_components"
passsy / material text
Last active Sep 15, 2021
Material font sizes
View material text
Zren / gist:beaafd64f395e23f4604
Last active Apr 29, 2017
Ionic Scroll onMouseWheel
View gist:beaafd64f395e23f4604
app.directive 'mouseWheelScroll', ($timeout) ->
return {
restrict: 'A'
# require: '^$ionicScroll'
link: ($scope, $element, $attrs) ->
scrollCtrl = $element.controller('$ionicScroll')
console.log scrollCtrl
unless scrollCtrl
return console.error('mouseWheelScroll must be attached to a $ionicScroll controller.')
panurge-ws / gist:525caef640784a487aa2
Last active May 20, 2016
A Videgular plugin to emulate background-size CSS property for video (see comment below).
View gist:525caef640784a487aa2
* vg-bkg-size
* A Videogular plugin to emulate background-size CSS property for video: "cover" or "contain"
* Use:
* <videogular vg-bkg-size="cover" center="true"></videogular>
* vg-bkg-size => "cover" or "contain"
* center => true or false
* Copyright (c) 2014 Panurge Web Studio
michalkvasnicak / angular-better-image-lazy-load.js
Last active Dec 2, 2019
Better image lazy loading in AngularJS
View angular-better-image-lazy-load.js
angular.module('Demo', []).service(
'scrollAndResizeListener', function($window, $document, $timeout) {
var id = 0,
listeners = {},
function invokeListeners() {
var clientHeight = $document[0].documentElement.clientHeight,
clientWidth = $document[0].documentElement.clientWidth;
mseeley / webworker-preloader.html
Created Mar 3, 2014
WebWorker Image preloader proof of concept (Tested in Mobile Safari 6.0/IOS 6.1.3 and Chrome 33)
View webworker-preloader.html
<!DOCTYPE html>
<title>WebWorker image preloading</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<div id="output"></div>
<script id="imgloader" type="javascript/worker">
// Not race proof or robust. Proof of concept.
compact / dropzone-directive.js
Last active Apr 29, 2020
AngularJS directive for Dropzone.js
View dropzone-directive.js
* An AngularJS directive for Dropzone.js,
* Usage:
* <div ng-app="app" ng-controller="SomeCtrl">
* <button dropzone="dropzoneConfig">
* Drag and drop files here or click to upload
* </button>
* </div>