Skip to content

Instantly share code, notes, and snippets.

Avatar

Mikhail Davydov azproduction

View GitHub Profile
@azproduction
azproduction / dump-indexed-db.js
Created Jul 8, 2021
Dumps all IndexedDB databases and saves all of them into a json file
View dump-indexed-db.js
;(async () => {
async function dumpDatabase(dbName) {
var dbExists = await new Promise(resolve => {
var request = window.indexedDB.open(dbName)
request.onupgradeneeded = e => {
e.target.transaction.abort()
resolve(false)
}
request.onerror = () => resolve(true)
request.onsuccess = () => resolve(true)
@azproduction
azproduction / b_.with.jsx
Last active Aug 29, 2015
BEM class name generator curring – b_.with
View b_.with.jsx
var B = require('b_');
var Array_of = function (any) {
return Array.prototype.slice.call(any);
};
B.with = function () {
var b = this,
curriedArgs = Array_of(arguments);
View scrollIntoView.js
/*!
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
*/
/**
* Better Element.scrollIntoView() implementation
*
* @see https://github.com/jquery/jquery-ui/blob/master/ui/menu.js#L409-L425
*
@azproduction
azproduction / cl.js
Last active Aug 29, 2015
WebStorm Live Templates
View cl.js
console.log($LINE$);
// LINE = lineNumber()
@azproduction
azproduction / _action.js
Last active Aug 29, 2015
Vision of Flux
View _action.js
// Action signature should be descriptive so IDE could use it.
var actionSet = createActions({
/**
* @param {object} data
* @param {string} data.name
* @param {string} data.value
*/
a: function actionMiddleware(data) {
// Case validate data
if (validate(data)) {
View index.js
// node --allow-natives-syntax index.js
var before, after, a;
before = %GetHeapUsage();
a = {};
after = %GetHeapUsage();
console.log(after - before);
@azproduction
azproduction / index.md
Created Apr 11, 2014
Deleted prototype element or function
View index.md
var encodeURIComponent, Array_push, Number_toString;
(function() {
    var iframe = document.createElement('iframe'), loaded = false;
    iframe.style.width = '1px';
    iframe.style.height = '1px';
    iframe.style.position = 'absolute';
    var onloadIframe = function() {
        if (!loaded && iframe.contentWindow) {
 loaded = true;
@azproduction
azproduction / index.md
Last active Feb 27, 2019
Спецификация 1CSS (статус: черновик спецификации)
View lmd.scope.js
/**
*
* @param {String} moduleName module name or path to file
*/
function require(moduleName) {}
/**
* Matches in-package modules
*
* @param {RegExp} regExp
@azproduction
azproduction / event.js
Last active Dec 16, 2015
yet another EventManager
View event.js
function EventManager () {
this._events = {};
}
EventManager.prototype = {
_event: function (type) {
var events = this._events[type];
if (!events) {
events = this._events[type] = {};