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
| <body> | |
| <button id="getQuote">Get a Quote | |
| </button> | |
| <h1 id="quote-content"> | |
| </h1> | |
| <h2 id="quote-title"> | |
| </h2> | |
| <button id="btnTweet">Tweet This</button> | |
| </body> |
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
| //Mozilla documentation for geolocation | |
| function getWeather() { | |
| var output = document.getElementById("out"); | |
| var picture = document.getElementById("icon"); | |
| if (!navigator.geolocation){ | |
| output.innerHTML = "<p>Geolocation is not supported by your browser</p>"; | |
| return; | |
| } | |
| function success(position) { |
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
| <body> | |
| <input id="startSearch" type="text"> | |
| <button onClick="getEntries()">Search Wikipedia</button> | |
| <div> | |
| <button onClick="getRandom()">Get Random Entry</button> | |
| </div> | |
| <div id="showResults"> | |
| </div> | |
| </body> |
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 getFeed() { | |
| $.getJSON('https://wind-bow.glitch.me/twitch-api/streams/freecodecamp?callback=?', function(data) { | |
| var isStreaming = document.getElementById("report"); | |
| if (data.stream == null) { | |
| isStreaming.innerHTML = "Down" | |
| } | |
| else { | |
| var a = document.createElement("a"); | |
| var streamStatus = document.createTextNode("Up"); | |
| a.appendChild(streamStatus); |
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
| //sum array of two numbers and all numbers in between | |
| //positive numbers only | |
| function sumAll(arr) { | |
| var min = arr.reduce(function(a, b) { | |
| return Math.min(a, b); | |
| }); | |
| var max = arr.reduce(function(a, b) { | |
| return Math.max(a, b); | |
| }); | |
| if (min == max) { |
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
| <div id='main'> | |
| <br/> | |
| <h1 id='display'> | |
| </h1> | |
| <br> | |
| <div id='buttons'> | |
| <button class='num'> | |
| 1 | |
| </button> | |
| <button class='num'> |
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
| <h1>Change Time</h1> | |
| <input type='text' id='inputTime' name='time' /> | |
| <div><input type='submit' id='submit-button' value='Start'/> | |
| <button id='reset'> | |
| Reset | |
| </button> | |
| <button id='reset'> | |
| Stop | |
| </button></div> | |
| <div id='tomato'> |
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
| <div id="app"></app> |
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
| #Code Wars kata solution | |
| def damaged_or_sunk (board, attacks): | |
| hits = [] | |
| results = { 'sunk': 0, 'damaged': 0 , 'not_touched': 0, 'points': 0} | |
| for attack in attacks: | |
| x = attack[0]-1 | |
| y = len(board)-attack[1] | |
| if board[y][x] != 0: | |
| hits.append(board[y][x]) | |
| board[y][x] = "X" |
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
| //reference: https://reactjs.org/docs/state-and-lifecycle.html | |
| class Counter extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = {count: 0}; | |
| } | |
| componentDidMount() { | |
| this.timerID = setInterval( | |
| () => this.tick(), |