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
| class Person | |
| attr_accessor :name | |
| def initialize(name) | |
| @name = name | |
| end | |
| end |
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
| // Controls the font size in pixels. | |
| "editor.fontSize": 12, | |
| // Controls auto save of dirty files. Accepted values: 'off', 'afterDelay', 'onFocusChange' (editor loses focus), 'onWindowChange' (window loses focus). If set to 'afterDelay', you can configure the delay in 'files.autoSaveDelay'. | |
| "files.autoSave": "off", | |
| // Controls the font family. | |
| "editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace", |
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 rollDice (rolls) { | |
| var result = "Rolled " + rolls + " dice: " | |
| for (var i = 0; i < rolls; i++) { | |
| var rollNum = Math.floor((Math.random(rolls)*6)+1); | |
| if (i < rolls - 1) { | |
| result += (rollNum + ", "); | |
| } else { | |
| result += rollNum; | |
| } | |
| } |
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 rollDice (rolls) { | |
| var result = "Rolled " + rolls + " dice: " | |
| for (var i = 0; i < rolls; i++) { | |
| var rollNum = Math.floor((Math.random(rolls)*6)+1); | |
| if (i < rolls - 1) | |
| result += (rollNum + ", "); | |
| else | |
| result += rollNum + "."; | |
| } | |
| return result; |
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 changeWord (string) { | |
| var result = ""; | |
| for (var i = 0; i < string.length; i++) { | |
| if (string[i] === "a") { | |
| result += "4"; | |
| } else if (string[i] === "e") { | |
| result += "3"; | |
| } else if (string[i] === "o") { | |
| result += "0"; | |
| } else if (string[i] === "l") { |
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 loopyLighthouse (start, end, number1, number2, replace1, replace2) { | |
| for (var i = start; i <= end; i++) { | |
| if (i % number1 === 0 && i % number2 === 0) { | |
| console.log(replace1 + replace2); | |
| } | |
| else if (i % number1 === 0) { | |
| console.log(replace1); | |
| } | |
| else if (i % number2 === 0) { | |
| console.log(replace2); |
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 pigLatin (string) { | |
| var result = ""; | |
| for (var i = 1; i < string.length; i++) { | |
| result += string[i]; | |
| } | |
| result += string[0]; | |
| result += "ay"; | |
| return result; | |
| }; |
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 reverse (string) { | |
| var result = ""; | |
| for (var i = string.length-1; i >= 0; i--) { | |
| result += string[i]; | |
| } | |
| return result; | |
| }; | |
| for (var i = 2; i < process.argv.length; i++) { | |
| var string = process.argv[i]; |