Skip to content

Instantly share code, notes, and snippets.

Code wins arguments

Alexander frontenddeveloping

Code wins arguments
View GitHub Profile
frontenddeveloping /
Created Feb 15, 2016 — forked from ericelliott/ - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin
View jquery.leaks.js
* Watcher leaks for jQuery
* RubaXa <>
* MIT Licensed.
* API:
* $.leaks.get();
* $;
* $.leaks.unwatch();
* $.leaks.remove();
frontenddeveloping / pdfjs-file-parser.js
Created Jan 18, 2016
Parse uploaded pdf file by PDF.js for number of pages and count links
View pdfjs-file-parser.js
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src=""></script>
<script src=""></script>
<link href="" rel="stylesheet" type="text/css" />
<script src=""></script>
View sw-example.js
var version = 'v2.0.24:';
var offlineFundamentals = [
//Add core website files to cache during serviceworker installation
var updateStaticCache = function() {
return + 'fundamentals').then(function(cache) {
View fetch-api-wrapper.js
(function(global) {
'use strict';
var JSON_TYPE_NAME = 'type';
function getQueryString(queryParams) {
var params = Object.keys(queryParams).map(function(paramName) {
return [paramName, encodeURIComponent(queryParams[paramName])].join('=');
return '?' + params.join('&');
frontenddeveloping / async-javascript-loading.js
Last active Aug 29, 2015
Async javascript loading (with saving order).
View async-javascript-loading.js
The main feature is script.async = false.
The async IDL attribute controls whether the element will execute asynchronously or not.
So if you will set async to false, scripts will load without blocking user i/o, but scripts will execute synchronously.
FF 4+
FF for Android All Versions
IE 10+ (starting with preview 2)
Chrome 12+
Chrome For Android All versions
frontenddeveloping / dataUri2Blob.js
Created Jun 20, 2014
Conversion dataUri string to Blob
View dataUri2Blob.js
function dataUri2Blob (dataUri) {
var dataUriArr = dataUri.split(';base64,'),
imageType = dataUriArr[0].replace('data:', ''),
base64Str = dataUriArr[1],
BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MSBlobBuilder || window.MozBlobBuilder,
binaryString = window.atob(base64Str),
frontenddeveloping / index.html
Created May 29, 2014
FileReader.prototype.readAsArrayBuffer vs FileReader.prototype.readAsDataUrl
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>FileReader test</title>
<form action="">
<input type=file multiple accept="image/*"><br/>
<input type=submit value="Run test">
frontenddeveloping / array mergeAsNumber
Last active Aug 29, 2015
Array.prototype.mergeAsNumber example
View array mergeAsNumber
Array.prototype.mergeAsNumber = function (array) {
var sortFunction = function (a,b) {return a-b},
commonArray = this.concat(array).sort(sortFunction),
for (var i = 0, l = commonArray.length; i<l; i++) {
element = commonArray[i];
suchNumberAnotherIndex = commonArray.indexOf(element, i+1);
while (suchNumberAnotherIndex > -1) {
frontenddeveloping / javascript-tabs.html
Last active Feb 13, 2018
My example can open many links in tabs, not in new windows. Why need this and do not use Because there is the problem - if you call once it will open new tab or window(it depends of browser), if will call two or more times - first will open like tab/window and all next in the new window only. The individual b…
View javascript-tabs.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Open 3 tabs</title>
<script src=""></script>
<div id="hidden_div"></div>