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
| /* | |
| The map() method creates a new array populated with the results | |
| of calling a provided function on every element in the calling array. | |
| .map(currentValue, index||optional||, currentArray||optional||) | |
| */ | |
| const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| const reversedArray = arr.map((v, k, array) => array[array.length - 1 - k]) |
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
| let matrix = [ | |
| [7, 8, 9], | |
| [1, 2, 3], | |
| [4, 5, 6], | |
| ] | |
| for(let i = 0; i < matrix.length; i++){ | |
| for(let j = i; j < matrix.length; j++){ | |
| let temp = matrix[i][j] | |
| matrix[i][j] = matrix[j][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
| const original = | |
| `v=0 | |
| o=bulma bulma@capsule.corporation.com | |
| s= | |
| t=0 | |
| m=audio 123 rtp | |
| a=128kbps | |
| a=no-echo | |
| a=filters | |
| a=dragon-effect |
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 i = 0; | |
| var txt = 'Lorem ipsum typing effect!'; | |
| var speed = 100; | |
| function typeWrite(){ | |
| if(i < txt.length){ | |
| document.getElementById("demo").innerHTML += txt.charAt(i); | |
| 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
| function Subject(){ | |
| this.observers = [] | |
| } | |
| Subject.prototype = { | |
| subscribe: function(fn) { | |
| this.observers.push(fn) | |
| }, | |
| unsubscribe: function(rmv){ | |
| this.observers = this.observers.filter(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
| function Developer(name){ | |
| this.name = name | |
| this.type = "Developer" | |
| } | |
| function Tester(name){ | |
| this.name = name | |
| this.type = "Tester" | |
| } |
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
| /* | |
| Write a range function that takes two arguments, start and end, and returns an array | |
| containing all the numbers from start up to (and including) end. | |
| Next, write a sum function that takes an array of numbers and returns the sum of these numbers. | |
| Run the example program and see whether it does indeed return 55. | |
| As a bonus assignment, modify your range function to take an optional third argument that indicates | |
| the “step” value used when building the array. If no step is given, the elements go up by increments | |
| of one, corresponding to the old behavior. The function call range(1, 10, 2) should return [1, 3, 5, 7, 9]. |
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
| /* ELOQUENT JAVASCRIPT EXERCISES | |
| Write a function countBs that takes a string as its only argument and returns a numbe | |
| that indicates how many uppercase “B” characters there are in the string. | |
| Next, write a function called countChar that behaves like countBs, except it takes | |
| a second argument that indicates the character that is to be counted (rather than counting | |
| only uppercase “B” characters). Rewrite countBs to make use of this new function. | |
| */ | |
| const countBs = (str) =>{ |
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
| // @gabrielmodog - 02/20/2019 - 14:50 | |
| // initialize | |
| const canvas = document.getElementById("game"); | |
| const ctx = canvas.getContext("2d"); | |
| // number of lines | |
| const counter = 90; | |
| // canvas screen size | |
| canvas.width = 400; |
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
| -- library to help with game engines and games and another applications | |
| -- Pilula.lua || @GabrielModog | |
| -- WORKING IN PROGRESS | |
| -- Modification 18:41 - 11 August 2018 | |
| -- Modification 19:44 - 27 August 2018 | |
| -- simplification | |
| local ti = table.insert | |
| local tr = table.remove |