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 [mainPlayerData, setMainPlayerData] = useState(null); | |
| const [otherPlayerData, setOtherPlayerData] = useState(null); | |
| const getPlayerParticipantId = (accountId, data) => | |
| data.participantIdentities.find(({ player }) => player.accountId === accountId).participantId; | |
| const getNameFromParticipantId = (data, id) => | |
| data.participantIdentities.find(({ participantId }) => participantId === id).player.summonerName; | |
| const getRelevantStats = stats => { |
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 accountId = "USJ23mFRVd7vw4cZJpb2GD8t3QF1Qsa6TusCvCkQN4uD0_Q" | |
| // Helper functions: | |
| // Find the object that tells us the participant ID of the player whose account key we know | |
| const getPlayerParticipantId = (accountId, data) => { | |
| const { participantId } = data.participantIdentities.find(({ player }) => player.accountId === accountId) | |
| return participantId; | |
| } |
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 accountId = "USJ23mFRVd7vw4cZJpb2GD8t3QF1Qsa6TusCvCkQN4uD0_Q" | |
| // Helper functions: | |
| // Find the object that tells us the participant ID of the player whose account key we know | |
| const getPlayerParticipantId = (accountId, data) => { | |
| const { participantId } = data.participantIdentities.find(({ player }) => player.accountId === accountId) | |
| return participantId; | |
| } |
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
| 'page.googlesidebar.load': async (props = {}) => { | |
| const { default: librarianReducer } = await import('./reducers/librarian'); | |
| const store$ = new BehaviorSubject(); | |
| combineLatest( | |
| action$ |> scan(librarianReducer, undefined), | |
| user$, | |
| Object.assign.bind({}), | |
| ).subscribe(store$); |
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 sumItems(array) { | |
| var total = 0; | |
| array.forEach((item) => { | |
| if (Array.isArray(item)) { | |
| total += sumItems(item); | |
| } else { | |
| total += item; | |
| } | |
| }) | |
| return total; |
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
| app.get('/users/:id', (req, res) => { | |
| let user = req.params.id; | |
| knex('users') | |
| .where({ id: user }) | |
| .then((row) => { | |
| let info = { | |
| name: '', | |
| maps: [], | |
| favorites: [] | |
| }; |
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 input = Number(process.argv.slice(2)); | |
| function rollDice(numRolls) { | |
| var result = []; | |
| for (var i = 0; i < numRolls; i++) { | |
| result.push(Math.floor(Math.random() * 6 + 1)); | |
| } | |
| console.log(`Rolled ${numRolls} dice: ` + result.join(', ')); | |
| } |
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 input = process.argv[2]; | |
| var obfuscate = function(str) { | |
| var result = str.split(''); | |
| var replaceLibrary = { 'a': '4', 'e': '3', 'o': '0', 'l': '1' }; | |
| for (i = 0; i < Object.keys(replaceLibrary).length; i++) { | |
| for (j = 0; j < result.length; j++) { | |
| if (Object.keys(replaceLibrary)[i] == result[j]) { | |
| result[j] = Object.values(replaceLibrary)[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
| var input = []; | |
| for (i = 2; i <= process.argv.length - 1; i++) { | |
| input.push(process.argv[i]); | |
| }; | |
| var pigLatin = function(input) { | |
| var result = ''; | |
| for (i = 0; i < input.length; 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
| var input = []; | |
| for (i = 2; i <= process.argv.length - 1; i++) { | |
| input.push(process.argv[i]); | |
| }; | |
| var reverse = function(arr) { | |
| var stringArr = []; | |
| var result = ''; | |
| for (i = 0; i < arr.length; i++) { |
NewerOlder