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
def take_out_elements(list_object, indices): | |
"""Removes elements from list in specified indices""" | |
removed_elements = [] | |
indices = sorted(indices, reverse=True) | |
for idx in indices: | |
if idx < len(list_object): | |
removed_elements.append(list_object.pop(idx)) | |
return removed_elements |
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
def split(arr, size): | |
"""Splits an array to smaller arrays of size""" | |
arrays = [] | |
while len(arr) > size: | |
piece = arr[:size] | |
arrays.append(piece) | |
arr = arr[size:] | |
arrays.append(arr) | |
return arrays |
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
// Step 1. Add and initialize your third-party JavaScript pixel (make sure to exclude HTML) | |
(function(w, d, s, l, i) { | |
w[l] = w[l] || []; | |
w[l].push({ | |
'gtm.start': new Date().getTime(), | |
event: 'gtm.js' | |
}); | |
var f = d.getElementsByTagName(s)[0], | |
j = d.createElement(s), | |
dl = l != 'dataLayer' ? '&l=' + l : ''; |
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
//Listen to datalaLayer.push calls (does not actually execute the push) | |
dataLayer.push = function(obj){ console.log('Something was pushed in the dataLayer');console.log(obj);} |
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
window.addEventListener('message', function (e) { | |
console.log(e.data) | |
}); |
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
<script> | |
var contentDiv = document.querySelector(".et-pb-contact-message"); | |
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
if(mutation.type==="childList"&& contentDiv.innerHTML.indexOf("Merci pour votre e-mail") !=-1) { | |
dataLayer.push({'event': 'contactFormSent'}); | |
observer.disconnect(); | |
} | |
}); |
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
//This is used in findBalancedSets function, to reduce processing time for large sets of combinations | |
function combiLoopOptimizer(combinationsR, playerNames) { | |
var start = 0; | |
var skipRanges = []; | |
skipRanges.length = combinationsR[0].length; | |
for (var i = playerNames.length; i >= 0; i--) { | |
//size of range to skip | |
var temp = Math.floor(getTotalCombinations(i - 1, teamsize - 1)); | |
//start of range to skip |
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
//Convert a file to an array (each line /n as an element) | |
public String[] UrlFileToArray(String fileurl){ | |
ArrayList inputFile =readFile(fileurl); | |
String urlArray[] = (String[])inputFile.toArray(new String[inputFile.size()]); | |
return urlArray; | |
} |
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
//Author Wayne Burkett | |
//https://stackoverflow.com/questions/5033836/adding-console-log-to-every-function-automatically#5034657 | |
//Add console log to all existing function existing in 5he global namespace at the time of execution | |
function augment(withFn) { | |
var name, fn; | |
for (name in window) { | |
fn = window[name]; | |
if (typeof fn === 'function') { | |
window[name] = (function(name, fn) { |