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 makeChromeSmoothReplaceImage(img, maximumSize){ | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext('2d'); | |
var newImg = new Image(); | |
newImg.onload = function(){ | |
var width = parseInt(this.width), | |
height = parseInt(this.height); |
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
var r = /\<script[\w\s\W]+?(\[CDATA\[)([\w\s\W]+?)(\]\]\>([\w\n]|)\<\/script\>)/ |
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 dump(context, options) { | |
function type(value){ | |
var type = ''; | |
if( Object.prototype.toString.call( value ) === '[object Array]' ){ | |
type = 'array'; | |
} else if(typeof value == 'object' ) { | |
type = 'object'; | |
} else { | |
type = 'primitive'; |
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
// imagine having a lot of || making it a very long line, you'd want to add newlines to improve readability/editability | |
// e.g.: if (foo || bar || baz || moo || stuff || thingy) { } | |
// we use for 4 spaces for tabs and having no space after the if doesn't line it up nicely | |
if(foo | |
|| bar) | |
{ | |
// .. | |
} | |
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
var codes = []; | |
var charsNumber = '437'.split(''); | |
var charsString = 'CKX'.split(''); | |
var getCharRndString = function(){ | |
return charsString[ Math.floor(Math.random()* charsString.length) ]; | |
} | |
var getCharRndNumber = function(){ | |
return charsNumber[ Math.floor(Math.random()*charsNumber.length) ]; | |
} |
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
javascript:(function(k)%7Bvar m,d,c,n%3Ddocument.body,h%3D"",a%3Dnavigator.userAgent,g%3D3%3Bswitch(true)%7Bcase a.indexOf("WebKit")!%3D-1:h%3D"webkit"%3Bbreak%3Bcase a.indexOf("Firefox")!%3D-1:h%3D"moz"%3Bbreak%3Bcase a.indexOf("Opera")!%3D-1:h%3D"o"%3Bbreak%3Bcase a.indexOf("Opera")!%3D-1:h%3D"o"%3Bbreak%7Dm%3Dh%2B"TransformStyle"%3Bd%3Dh%2B"Transform"%3Bc%3Dh%2B"Perspective"%3BperspectiveOrigin%3Dh%2B"PerspectiveOrigin"%3Bn.style%5Bm%5D%3D"preserve-3d"%3Bn.style%5Bd%5D%3D"translateZ(100px)"%3Bfor(var f%3D0,e%3Dn.childNodes.length%3Bf<e%3B%2B%2Bf)%7Bif(n.childNodes%5Bf%5D.nodeType!%3D3%26%26n.childNodes%5Bf%5D.style)%7Bn.childNodes%5Bf%5D.style%5Bc%5D%3D400%7D%7Dvar b%3D%5B%5D%3Bfunction j(s,t)%7Bvar o%3Ds.childNodes,q%3Dt*g%3Bs.style%5Bm%5D%3D"preserve-3d"%3Bfor(var r%3D0,p%3Do.length%3Br<p%3B%2B%2Br)%7Bif(o%5Br%5D.nodeType!%3D3%26%26o%5Br%5D.style)%7Bo%5Br%5D.style%5Bd%5D%3D"translateZ("%2Bq%2B"px)"%3Bb.push(o%5Br%5D)%3Bif(o%5Br%5D.childNodes.length>0)%7Bj(o%5Br%5D,t%2B1)%7D%7D%7D%7Ddocument.onmousemove%3 |
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
// A bitwise FlagMachine | |
// create a enum | |
enum PizzaIngredients { | |
BREAD = 1 << 0, | |
CHEESE = 1 << 1, | |
TOMATO = 1 << 2, | |
UNIONS = 1 << 3, | |
GARLIC = 1 << 4, | |
} |
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
var v = '00:05:19 00:08:13 00:09:19 00:10:23 00:12:02 00:13:06 00:13:19 00:14:11 00:15:10 00:16:17 00:18:03 00:20:06 00:21:09 00:22:03 00:23:09 00:23:20 00:24:19 00:26:03 00:27:19 00:28:15 00:29:23 00:30:21 00:31:21 00:34:07 00:36:11 00:37:18 00:39:12 00:40:19 00:42:12 00:45:22 00:46:19'; | |
var events = {} | |
var prev = 0; | |
var curr = 0; | |
v.split(' ').forEach((value, index) => { | |
curr = timeToFloat(value) | |
if(index>0){ | |
events['moment_' + index] = [prev, curr] | |
} |
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 mod(a, b){ | |
return a - b * Math.floor(a/b) | |
} |
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\s(\w+)\s=\srequire\(\'([\w.\s\/]+)\'\)\; | |
import $1 from '$2'; |
OlderNewer