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 convertToRoman(inputNum) { | |
| var letters = ['I', 'V', 'X', 'L', 'C', 'D', 'M']; | |
| var digits = String(inputNum).split('').reverse(); | |
| var roman = []; | |
| for (var i = 0, length = digits.length; i < length; i++) { | |
| var value = Number(digits[i]); | |
| var splitStart = i * 3 - 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
| local AppendLists in | |
| fun {AppendLists L1 L2} | |
| local Aux in | |
| fun {Aux List Acc} | |
| case List of | |
| Head|Tail then {Aux Tail (Head | Acc)} | |
| else Acc | |
| end | |
| end | |
| {Aux {Reverse L1} L2} |
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
| defmodule Pinner do | |
| def first do | |
| case 10 do | |
| # `x` sempre dá match porque sendo ele | |
| # uma variável, representa-se que qualquer | |
| # valor arbitrário pode ser aceito no caso | |
| x -> | |
| "x" | |
| 10 -> | |
| "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
| <h1 id="page">No Page</h1> | |
| <button data-page="Home" data-delay="1000">Home</button> | |
| <button data-page="Users" data-delay="1500">Users</button> | |
| <button data-page="Posts" data-delay="3000">Posts</button> |
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 $page = document.getElementById('page') | |
| const setPage = title => { | |
| $page.innerText = title | |
| } | |
| const loadPage = (title, time) => | |
| new Promise(resolve => | |
| setTimeout(() => resolve(title), time) | |
| ) |
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 $page = document.getElementById('page') | |
| let currentPage = 'no-page' | |
| const setPage = title => { | |
| if (currentPage !== title) return; | |
| $page.innerText = title | |
| } | |
| const loadPage = (title, time) => | |
| new Promise(resolve => |
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 $page = document.getElementById('page') | |
| let currentPage = 0 | |
| const setPage = title => { | |
| $page.innerText = title | |
| } | |
| const loadPage = (title, time) => | |
| new Promise(resolve => | |
| setTimeout(() => resolve(title), time) |
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 $page = document.getElementById('page') | |
| const router = { | |
| listeners: [], | |
| onPageChange(fn) { | |
| this.listeners.push(fn) | |
| } | |
| } |
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 counter = 0 | |
| function count() { | |
| return counter++ | |
| } |
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
| /** | |
| * Show Me the Evens - Show me the Odds | |
| * Diana is learning to count and she just learned the difference between odds and even numbers. | |
| * She wants to have some fun, so she picks a random number. | |
| * If that number is even, she decides to count all the even numbers up to it starting from 0 up to (but not including) the input. | |
| * If not, she decides to count all the odd numbers up to that number starting from 1 (but not including) the input. | |
| **/ | |
| function counting(x){ | |
| return [...Array(x).keys()] |
OlderNewer