This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.mergeAsNumber = function (array) { | |
var sortFunction = function (a,b) {return a-b}, | |
commonArray = this.concat(array).sort(sortFunction), | |
element, | |
suchNumberAnotherIndex; | |
for (var i = 0, l = commonArray.length; i<l; i++) { | |
element = commonArray[i]; | |
suchNumberAnotherIndex = commonArray.indexOf(element, i+1); | |
while (suchNumberAnotherIndex > -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>FileReader test</title> | |
</head> | |
<body> | |
<form action=""> | |
<input type=file multiple accept="image/*"><br/> | |
<input type=submit value="Run test"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | |
bytes, | |
arrayBuffer, | |
blob; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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. | |
Support: | |
FF 4+ | |
FF for Android All Versions | |
IE 10+ (starting with preview 2) | |
Chrome 12+ | |
Chrome For Android All versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Watcher leaks for jQuery | |
* RubaXa <trash@rubaxa.org> | |
* MIT Licensed. | |
* | |
* API: | |
* $.leaks.get(); | |
* $.leaks.watch(); | |
* $.leaks.unwatch(); | |
* $.leaks.remove(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote prune origin | |
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add the following to your .bashrc (change path as necessary): | |
alias ruby='/cygdrive/c/Ruby193/bin/ruby' | |
alias gem='/cygdrive/c/Ruby193/bin/gem.bat' | |
alias irb='/cygdrive/c/Ruby193/bin/irb.bat' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@DevToolsPerfTest('my_super_fast_code') | |
Array(1e6).fill(1).map(() => Math.random()) | |
//@DevToolsPerfTestEnd('my_super_fast_code', 5) | |
// if my code runs more than 5ms I want to get warining in console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PENDING_STATE = 'pending'; | |
const REJECTED_STATE = 'rejected'; | |
const RESOLVED_STATE = 'resolved'; | |
class Deferred { | |
static PENDING_STATE = PENDING_STATE; | |
static REJECTED_STATE = REJECTED_STATE; | |
static RESOLVED_STATE = RESOLVED_STATE; | |
constructor() { | |
let state = PENDING_STATE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
import path, { resolve } from 'path'; | |
import assert from 'assert'; | |
import Module from 'module'; | |
import jsdom from 'jsdom'; | |
import Mocha from 'mocha'; | |
import chokidar from 'chokidar'; | |
// Let's import and globalize testing tools so | |
// there's no need to require them in each test |
OlderNewer