🚧 Still in progress
- Javascript/NodeJs/TypeScript
- PostgreSQL
| // JavaScript Document | |
| // adiciona mascara para rg | |
| // Cada estado têm regras e quantidades diferentes de números no registro. Por isso, | |
| // não há uma maneira confiável de fazer a validação do mesmo. | |
| function MascaraRg(v0,errChar='?'){ | |
| const v = v0.toUpperCase().replace(/[^\dX]/g,''); | |
| return (v.length==8 || v.length==9)? | |
| v.replace(/^(\d{1,2})(\d{3})(\d{3})([\dX])$/,'$1.$2.$3-$4'): | |
| (errChar+v0) |
| window.geocoder = new google.maps.ClientGeocoder(); | |
| geocoder.getLocations('rua xyz, sp', function(result){ | |
| var placemark = result.Placemark[0]; // Only use first result | |
| var accuracy = placemark.AddressDetails.Accuracy; | |
| var zoomLevel = 1; | |
| var lon = placemark.Point.coordinates[0]; | |
| var lat = placemark.Point.coordinates[1]; | |
| gmap.setCenter(new google.maps.LatLng(lat, lon), zoomLevel); | |
| }); |
| var requestFullscreen = function (ele) { | |
| if (ele.requestFullscreen) { | |
| ele.requestFullscreen(); | |
| } else if (ele.webkitRequestFullscreen) { | |
| ele.webkitRequestFullscreen(); | |
| } else if (ele.mozRequestFullScreen) { | |
| ele.mozRequestFullScreen(); | |
| } else if (ele.msRequestFullscreen) { | |
| ele.msRequestFullscreen(); | |
| } else { |
| <?php | |
| /** | |
| ** Convert DBF files to MySQL file | |
| ** contact: http://gschimpf.com/ | |
| ** | |
| ** USAGE: | |
| ** $filename = "dir/file.dbf"; | |
| ** // Show the result sql | |
| ** dbf2mysql::mostrarSQL($filename); |
| #!/bin/bash | |
| if ! [ -x "$(command -v docker-compose)" ]; then | |
| curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-\$(uname -s)-\$(uname -m)" -o /usr/local/bin/docker-compose | |
| chmod +x /usr/local/bin/docker-compose | |
| ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
| fi | |
| docker-compose --version |
| #!/bin/bash | |
| SERVICES_LIST=(http://localhost:3001/healthcheck http://localhost:3000/healthcheck) | |
| isServiceReady(){ | |
| ping=$(curl -s -f -LI $1) | |
| if [ -z "$ping" ]; then | |
| false; | |
| else | |
| true; |
| /* | |
| * Fetch users groups through an impersonated Service Account | |
| */ | |
| const { google } = require('googleapis'); | |
| const credentials = require('../service-account-credentials.json') | |
| const scopes = [ | |
| 'https://www.googleapis.com/auth/admin.directory.user.readonly', | |
| 'https://www.googleapis.com/auth/admin.directory.group.readonly', | |
| ] |
| const functions = require('firebase-functions'); | |
| const admin = require('firebase-admin'); | |
| admin.initializeApp(functions.config().firebase); | |
| exports.sendNotification = functions.database.ref('/messages/{pushId}/text').onWrite((event) => { | |
| const data = event.data; | |
| console.log('Message received'); | |
| if(!data.changed()){ | |
| console.log('Nothing changed'); | |
| return; |
| # Multi-stage | |
| # 1) Node image for building frontend assets | |
| # 2) nginx stage to serve frontend assets | |
| # Name the node stage "builder" | |
| FROM node:10 AS builder | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy all files from current directory to working dir in image | |
| COPY . . |