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
| for(let i = 1; i <= 100; i++){ | |
| crackle = i % 3 === 0 ? "Crackle" : ""; | |
| pop = i % 5 === 0 ? "Pop": ""; | |
| console.log(crackle+pop !== "" ? crackle+pop : 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
| const checkIfPythagTriplet = (a, b, c) => (c * c) === (a * a) + (b * b) | |
| const targetSum = 1000 | |
| /// slow loopy way | |
| // I don't know exactly which big O notation this is, but its bad.... | |
| // when I check the time on this one (running it up to product of 10,000 on my local machine takes 114.67s ) | |
| let a = 1; | |
| let b = 1; | |
| let c = 2; |
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
| diceOptions = ["nectar/wheat", "bug", "nectar/bug", "nectar/cherry", "rat", "fish"] | |
| numberOfRolls = 50000 | |
| target = "nectar" | |
| const rollSinge = () => { | |
| const diceSide = Math.floor(Math.random() * 6) | |
| return diceOptions[diceSide] | |
| } | |
| // generate blank array with n 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
| var socket = io(); | |
| class GameList extends HTMLElement { | |
| connectedCallback() { | |
| this.setInnerHTML("No Active Games", []); | |
| socket.on("list of games", (gamesStr) => { | |
| const gamesObj = JSON.parse(gamesStr); | |
| const games = gamesObj["games"]; | |
| this.setInnerHTML("Ongoing Games", games); | |
| }); |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> | |
| <meta charset="UTF-8"/> | |
| <title>Vue demo</title> | |
| <style> | |
| .towers{ | |
| display:flex; | |
| justify-content: space-between; |
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 random | |
| from itertools import permutations, combinations | |
| class Card: | |
| """ | |
| A single card in a 52 card deck | |
| When creating a card the format is value 1(ace) to 13 king followed by 0-4 for a suite | |
| """ |
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 requests import get | |
| from requests.exceptions import RequestException | |
| from contextlib import closing | |
| from bs4 import BeautifulSoup | |
| def simple_get(url): | |
| """ | |
| Attempts to get the content at `url` by making an HTTP GET request. | |
| If the content-type of response is some kind of HTML/XML, return the | |
| text content, otherwise return None. |
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
| $.map($(".transactions-data-row"), function(i){ | |
| return { | |
| date: $.trim($(i).find(".transactions-date")[0].innerText).replace("\n", " "), | |
| location: $(i).find(".transactions-description")[0].innerText, | |
| amount: $(i).find(".transactions-amount b")[0].innerText, | |
| } | |
| }) |
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 GetQueueIdWhenRedirectedToTarget() { | |
| var n = window; | |
| return n.queueViewModel ? n.queueViewModel.getIsRedirectedToTarget ? n.queueViewModel.getIsRedirectedToTarget() ? n.queueViewModel.getQueueId() : void 0 : null : null | |
| } | |
| var __extends, QueueIt; | |
| (function(n) { | |
| var t; | |
| (function(n) { | |
| var t; | |
| (function(n) { |
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
| didUnlikelyHappen = function(){ | |
| if (Math.floor(Math.random()*10) === 2){ | |
| return true; | |
| }else{ | |
| return false; | |
| } | |
| } | |
| makePrediction = function(){ | |
| if(Math.random() > 0.5 ){ |
NewerOlder