This file contains hidden or 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 sortArr(arr, func){ | |
var sortedArr = [] | |
for(var i in arr){ | |
for(var o in sortedArr){ | |
if(func ? func(arr[i], sortedArr[o]) < 0 : arr[i] < sortedArr[o]){ break } | |
o++ | |
} | |
sortedArr.splice(o, 0, arr[i]) | |
} |
This file contains hidden or 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 testNumber = 3453453453434 | |
var tests = 10000; | |
//Test 1 | |
setTimeout(function(){ | |
var time = performance.now() | |
for(var i = 0; i < tests; i++) | |
numberAddComma(testNumber) | |
console.log('Function: ' + (performance.now() - time)) |
This file contains hidden or 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
/* | |
* Your Stylesheet | |
* | |
* This stylesheet is loaded when Atom starts up and is reloaded automatically | |
* when it is changed and saved. | |
* | |
* Add your own CSS or Less to fully customize Atom. | |
* If you are unfamiliar with Less, you can read more about it here: | |
* http://lesscss.org | |
*/ |
This file contains hidden or 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 canvas = document.querySelectorAll('canvas')[0] | |
canvas.width = 400; | |
canvas.height = 400; | |
var ctx = canvas.getContext('2d') | |
var img=document.getElementById("texture"); | |
//var pat=ctx.createPattern(img,"repeat"); | |
//var time = performance.now() | |
//for(var i = 0; i < 1000; i++){ |
This file contains hidden or 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 splitArrayIntoChunks(arr, chunkLen){ | |
var chunkList = [] | |
var chunkCount = Math.ceil(arr.length/chunkLen) | |
for(var i = 0; i < chunkCount; i++){ | |
chunkList.push(arr.splice(0, chunkLen)) | |
} | |
return chunkList | |
} | |
var testArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] |
This file contains hidden or 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 spells = { | |
shield: { | |
buff: { | |
type: 'reflect', | |
duration: 60 | |
}, | |
castTime: 30, | |
mana: -20 | |
}, |
This file contains hidden or 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 responsive = document.querySelector('.responsive'); | |
var resize = document.querySelector('.resize'); | |
var content = document.querySelector('.content'); | |
var mousedown = false; | |
var locX = 0; | |
var locY = 0; | |
var side = ""; | |
resize.addEventListener('mousedown', function(event){ |
This file contains hidden or 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
//Vanilla | |
button = document.getElementsByTagName('button')[0]; | |
button.addEventListener('click', function(){ | |
rotate(); | |
}); | |
var rotate = function(){ | |
var sides = ['show-front', 'show-back', 'show-left', 'show-right', 'show-top', 'show-bottom']; | |
var side = sides[Math.floor(Math.random()*sides.length)]; | |
This file contains hidden or 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 milliseconds = 101000; | |
console.log(convertMillToString(milliseconds)); | |
function convertMillToString(milliseconds){ | |
var totalSeconds = milliseconds/1000; | |
var totalMinutes = Math.floor(totalSeconds/60); | |
//Return Values | |
var hours = Math.floor(totalMinutes/60); | |
var minutes = totalMinutes - (hours*60); |
This file contains hidden or 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
<cfsetting showdebugoutput='no'> | |
<cfscript> | |
var string = '{ | |
"title":"Test Discount", | |
"code":"boomshaka", | |
"type":"by_percent", | |
"discountValue":"10", | |
"dateStart":"01/01/2017", | |
"dateEnd":"01/31/2017", | |
"aggregator":"any", |
NewerOlder