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
| /** | |
| * Created by Vampiire on 5/11/17. | |
| * Refactored for undefeatable AI at 4 am 5/13. X's and O's, Jack. | |
| Everything written from scratch, no guides, external help, or codes were copied unlike some others. | |
| */ | |
| // jQuery shortcuts | |
| var square = $('.square'), center = $('#square_5'), modal = $('.modal'), winnerOutput = $('#winnerOutput'); | |
| // global variables |
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
| /** | |
| * Created by Vampiire on 5/14/17. | |
| */ | |
| // jQuery shorcuts | |
| var touch = $('.touch'), screen = $('#screen'), | |
| door_creek = $('#door_creek'), power_button = $('#power'), power_icon = $('#power_icon'), strict_button = $("#strict"); | |
| // global variables |
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
| /** | |
| * Created by Vampiire on 5/18/17. | |
| */ | |
| function shortenNum(num, decimals){ | |
| if(num.toString()[decimals+2] === "5"){ | |
| return Number(Number(num.toString().slice(0, decimals+2) + 6).toFixed(decimals)); | |
| } | |
| return Number(num.toFixed(decimals)); |
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
| /** | |
| * Refactored by Vampiire on 5/19/17. | |
| * Now will correctly truncate regardless of how many integer digits are in place | |
| * (previously only worked for 1 integer digit) | |
| * | |
| * Looks for the index value of the decimal and treats this as the start of the slice | |
| * Seeks beyond the decimal point (+1) to the number of decimals specified by the user | |
| * Adds a 6 at this point so it will round up correctly to the number of decimals requested | |
| * | |
| */ |
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() { | |
| // Media query to determine if mobile is present | |
| var mobile; | |
| mobile = !window.matchMedia("(min-width: 420px)").matches; | |
| // JQuery shortcuts | |
| // Switches | |
| var |
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> | |
| <meta charset="UTF-8"> | |
| <title>test</title> | |
| </head> | |
| <body> | |
| <div id="test"> |
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
| // Excerpt from respond.js pertaining to the help responses for the /update command | |
| helpResponse = (type) => { | |
| let help = | |
| `*How to use the \`/update\` command:* \n\nUpdating works like git in stringing together mandatory and/or optional [-flag] [data] pairs to build your update command\nGeneral form: \`/update [profile item to update] [[-flag] [data]]\` | |
| \n*Available profile items and associated flags*: | |
| *Updating GitHub, Blog, or Portfolio URLs* | |
| \t*Item(s)* | |
| \t\t[\`git\`]: your github profile url |
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
| // Excerpt from controller.js focusing on the /update route that Slack sends all /update requests to | |
| router.post('/update', (req, res) => { | |
| const respond = require('./tools/respond'); | |
| const body = req.body; | |
| const arguments = body.text; | |
| if(tools.verify.slash(body.token)){ | |
| if(~arguments.indexOf(' ')){ |
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
| // scans a custom attachment object for errors | |
| errorScan = (type, customAttachment) => { | |
| const expectedKeys = ['text', 'callback_id', 'actions']; | |
| const expectedSubKeys = type === 'menu' ? ['name', 'type', 'data_source'] : ['text', 'name', 'type']; | |
| const keysError = verifyKeys(customAttachment, expectedKeys, 'outer attachment properties'); | |
| if(keysError){ | |
| return keysError; | |
| } |
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
| argumentParser = arguments => { | |
| const output = argumentSplitter(arguments); | |
| const item = output.item; | |
| const pairsArray = output.pairsArray; | |
| let flagDataPairs = {}; | |
| pairsArray.forEach( pairString => { | |
| let flag = pairString.slice(0, pairString.indexOf(' ')); | |
| let data = pairString.slice(pairString.indexOf(' ')+1); | |