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 moment = require("moment") | |
| // string date to test | |
| const now = '2017-11-2'; | |
| function getFirstTuesday(date) { | |
| result = moment(date).startOf('month'); | |
| while (result.day() !== 2) { | |
| result.add(1, 'day'); | |
| } |
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 speak(textToSpeak) { | |
| const synth = window.speechSynthesis; | |
| // Create a new instance of SpeechSynthesisUtterance | |
| var utterance = new SpeechSynthesisUtterance(); | |
| // Set the text | |
| utterance.text = textToSpeak; | |
| var voices = synth.getVoices(); |
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 fib(n) { | |
| if (n <= 2) return 1; | |
| return fib(n-1) + fib(n-2); | |
| } | |
| function _fib(n) { | |
| if (n <= 2) return 1; | |
| return mfib(n-1) + mfib(n-2); | |
| } |
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
| This is a set of vanillaJS helpers to pass on without jquery easier. |
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() { | |
| var views = {xs:0,sm:768,md:992,lg:1200}; | |
| var css = '*,:after,:before{box-sizing:border-box}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}[class^=col-]{position:relative;min-height:1px;padding-right:15px;padding-left:15px;float:left}'; | |
| for(var key in views) { | |
| if (views.hasOwnProperty(key)) { | |
| var value = views[key]; | |
| if (value!=0) css+='@media(min-width:'+ value +'px){.container{width:'+ parseInt(value-30,10) +'px}'; | |
| for (var i = 12; i > 0; i--) { | |
| css+='.col-'+key+'-'+i+'{width:'+(i/12)*100+'%}'; | |
| css+='.col-'+key+'-pull-'+i+'{right:'+(i/12)*100+'%}'; |
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 speak(textToSpeak) { | |
| // Create a new instance of SpeechSynthesisUtterance | |
| var utterance = new SpeechSynthesisUtterance(); | |
| // Set the text | |
| utterance.text = textToSpeak; | |
| var voices = window.speechSynthesis.getVoices(); | |
| utterance.voice = voices.filter(function(voice) { return voice.name == 'Anna'; })[0]; |
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> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
| <title>Google Maps Multiple Markers</title> | |
| <script src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
| <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="map" style="width: 500px; height: 400px;"></div> |