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 CryptoJS = require('crypto-js'); | |
| var algo = CryptoJS.algo.SHA256.create(); | |
| algo.update(password, 'utf-8'); | |
| algo.update(CryptoJS.SHA256(salt), 'utf-8'); | |
| var hash = algo.finalize().toString(CryptoJS.enc.Base64); | |
| console.log(hash); |
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 time[R](block: => R): R = { | |
| val t0 = System.nanoTime() | |
| val result = block // call-by-name | |
| val t1 = System.nanoTime() | |
| println("Elapsed time: " + (t1 - t0) + "ns") | |
| result | |
| } | |
| // Now wrap your method calls, for example change this... | |
| val result = 1 to 1000 sum |
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
| import string | |
| import random | |
| print ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(3000)) | |
| print len("A5WMMLXE5DBAQMFGRF8OSEB6K5MW972PORMU4ENBC4VDBEDWB5WEFYG2ECXAJ7YSWXE9P0TUSKCD3LZMPGG9VKKLTS04R0101OS02XTKAG9VI3T69YHK56NXORO8A9GI095422I3RSFY1QJDXZONXBKHEA9HB9JB0DPG56XNYTNDLG64ITAWEKB6PEY46OW391WQCBRPPDS2VDKY748S38P0FZURELCPTDDMWI301I6I0RP7FHT20DWTWHJUH2X0ECJ9VJM108IAAZWM058HXKQJ9W6R4A3QZFM17HVB4ZPB666RANSS0TVQ4B0FYKWAJP5XYV4820H8KRPQ7OHXU85KFUUFG45MFU67JC2RE05I02YFCS720S4IVXGGY6YQE47PKXMXMZJC160WKRU2OJS7KTONBOUXA4M6RCAZYVFJCIUQE5AKCYKCLMAYB1AMC2LUEE5T21OHXKAD54QAS68FU1M3BED8QH6UAO2XYCXO8R62O48RFVK8LSX7KTZYBV15U8LGGPINTF4XTXUWDU9LI39ES404YEZRHD5RLLX8WX8ND7R2RRQ9HBFH8OY4LFIJFD38CEQ95PAEW3TW7AJTMUXS27MP7FN2FXHY7F8FB7UFHTESBU3X6GDNZN6PIJNUXFBQHUM9BCD9FYXI6CY5NPIAQJKC98BHOUFBJOC3SLNCK0LARF0W0019YB8EETF6BT8PKUNIN3B0BHFIOQEARX1IDKVF00WNH0JIO9LEHPKINLZFHOZ2FXV48SM76B84NTDGIM24XMKDA2A4RQ7J4UCLBZTQJWCWTXBY6MQMX8BXIBJV5ZHB3EYM0CXFECN6H7XLE899FW2ADGMRDYRFH19TX9LXQ4MNQLS2ZC194N5M |
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
| private def isValidBSN(candidate: Int): Boolean = { | |
| var bsn = candidate | |
| if (bsn <= 9999999 || bsn > 999999999) { | |
| return false; | |
| } | |
| var sum: Int = -1 * bsn % 10; | |
| for (multiplier <- 2 to 1000 ; if bsn > 0) { | |
| bsn = bsn / 10 | |
| var value = bsn % 10 |
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
| import urllib | |
| import urllib2 | |
| import cookielib | |
| import json | |
| jira_serverurl = "{url to your jira environment}" | |
| creds = { "username" : "admin", "password" : "test" } | |
| authurl = jira_serverurl + "/rest/auth/latest/session" | |
| # Get the authentication cookie using the REST API |
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
| public void dragAndDrop2(WebElement element, int xOffset, int yOffset) throws Exception { | |
| Actions builder = new Actions(driver; | |
| Action dragAndDrop = builder.dragAndDropBy(element, xOffset, yOffset) .build(); | |
| dragAndDrop.perform(); | |
| } |
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
| /** | |
| * A convenience method that performs click-and-hold at the location of the source element, moves by a given offset, then releases the mouse. | |
| * @param slider webElement | |
| * @param xOffset - horizontal move offset. Positive value means moving to the right, negative - to the left | |
| * @param yOffset - vertical move offset. Positive value means moving up, negative - down | |
| * @throws Exception | |
| */ | |
| public void dragAndDrop(WebElement slider, int xOffset, int yOffset) throws Exception { | |
| Actions moveSlider = new Actions(driver); | |
| Action action = moveSlider.clickAndHold(slider) |
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
| public int randomIntGenerator(int minimum, int maximum) { | |
| Random rn = new Random(); | |
| return rn.nextInt(maximum - minimum) + minimum; | |
| } |
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
| public void waitForPageToLoad() { | |
| Wait<WebDriver> wait = new WebDriverWait(manager.getDriver(), 30); | |
| wait.until(new Function<WebDriver, Boolean>() { | |
| public Boolean apply(WebDriver driver) { | |
| System.out.println("Current Window State : " | |
| + String.valueOf(((JavascriptExecutor) driver).executeScript("return document.readyState"))); | |
| return String | |
| .valueOf(((JavascriptExecutor) driver).executeScript("return document.readyState")) | |
| .equals("complete"); | |
| } |