This file contains 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
/** | |
* 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ... | |
* The next number is found by adding up the two numbers before it. | |
* - The 2 is found by adding the two numbers before it (1+1) | |
* - Similarly, the 3 is found by adding the two numbers before it (1+2), | |
* - And the 5 is (2+3), and so on | |
*/ | |
// Using recursion | |
function fibonacciNumberOf(number) { |
This file contains 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
div { | |
height: 100px; | |
background-color: red; | |
background-image: | |
linear-gradient( | |
45deg, | |
#7BB9CF, | |
#848DD0, | |
#AC01CC, | |
#CD00A9, |
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="apple-touch-icon" href="apple-touch-icon.png"> | |
<link rel="stylesheet" href="css/normalize.min.css"> |
This file contains 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 findNextSquare(sq) { | |
// Optimal solution | |
// return Math.sqrt(sq)%1? -1 : Math.pow(Math.sqrt(sq)+1,2); | |
// Return the next square if sq if a perfect square, -1 otherwise | |
var curVal = Math.sqrt(sq) + 1 | |
var nextSq = Math.sqrt(sq) + 1 | |
nextSq *= nextSq | |
//console.log(sq) | |
//console.log(currentNumber) |
This file contains 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
//Kata: https://www.codewars.com/kata/vasya-clerk/train/javascript | |
function tickets(peopleInLine){ | |
var ticketPrice = 25 | |
var bills = [0, 0, 0] | |
// Just count the bills... forget the register value | |
for (var i = 0; i < peopleInLine.length; i++) { | |
if (peopleInLine[i] == ticketPrice) { | |
bills[0] += 1 // Clients with $25 are the easy ones |
This file contains 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
// Simple function definition | |
function function01() { | |
console.log('This is function #1') | |
} | |
// Function expression | |
const fnExpression = () => { | |
console.log('This is an function epression example') | |
} |
This file contains 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 http = require('http') | |
const port = 3000 | |
const requestHandler = (request, response) => { | |
console.log(request.url) | |
response.end('Hello Node.js Server!') | |
} | |
const server = http.createServer(requestHandler) |
This file contains 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
// Kevin Pilard @kpilard Apr 11 16:17 | |
// @jamesxv7 | |
import { Validator } from 'vee-validate'; | |
var app = new Vue({ | |
el: '#app', | |
created () { | |
this.validator = new Validator(this.validationRules) | |
}, |
This file contains 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 someFunc(array) { | |
// some code... | |
// some code... | |
const length = array.length; | |
for (let index = 0; index < length; index++) { | |
const item = array[index]; | |
// some | |
} | |
return 'some result'; | |
} |
OlderNewer