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
| // 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
| const axios = require('axios'); // promised based requests - like fetch() | |
| function getCoffee() { | |
| return new Promise(resolve => { | |
| setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
| }); | |
| } |
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
| import Swal from 'sweetalert2' | |
| import withReactContent from 'sweetalert2-react-content' | |
| import Signin from '@/components/Login/Signin' | |
| const RCSwal = withReactContent(Swal) | |
| RCSwal.fire({ | |
| title: <div>Login</div>, | |
| html: <Signin />, | |
| onOpen: () => { |
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 getLocation(cbSuccess, cbError) { | |
| if (navigator.geolocation) { | |
| return navigator | |
| .geolocation | |
| .getCurrentPosition(cbSuccess, cbError); | |
| } else { | |
| // Browser doesn't support Geolocation | |
| return 'Browser doesnt support Geolocation' | |
| } | |
| } |
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
| // Node.js 9 | |
| // Invertendo valores do Objeto | |
| /* | |
| Input <info.json> | |
| { 'OlaMundo' : 'HelloWorld' } | |
| Output <new.info.json> | |
| { 'HelloWorld' : 'OlaMundo' } | |
| */ |
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
| ### STAGE 1: Build ### | |
| FROM node:9-alpine | |
| RUN yarn global add serve | |
| WORKDIR /usr/src/app | |
| COPY package.json yarn.lock ./ | |
| RUN yarn | |
| COPY . ./ | |
| RUN yarn build |
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 csvJSON = function(csv){ | |
| var lines = csv.split("\n") | |
| var result = [] | |
| var headers = lines[0].split(",") | |
| lines.map(function(line, indexLine){ | |
| if (indexLine < 1) return // Jump header line | |
| var obj = {} |
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
| <div ng-app="myApp" ng-controller="MyCtrl"> | |
| <div after-render="missionCompled">element</div> | |
| </div> |
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
| //http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
| Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
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 isOdd(num) { return num % 2 !== 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
| var juros_simples = function(capital, taxa, n_periodos) { | |
| return capital * taxa * n_periodos; | |
| } |