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
| from PIL import Image | |
| def add_border(input_image_path, output_image_path, border_size=100): | |
| # Open an existing image | |
| img = Image.open(input_image_path) | |
| # Get the size of the original image | |
| width, height = img.size | |
| # Make the new image size as the original size plus the border |
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; | |
| } |