Skip to content

Instantly share code, notes, and snippets.

View mnsmarcelo's full-sized avatar
😜

Marcelo Sousa mnsmarcelo

😜
View GitHub Profile
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed on an "AS IS"
# BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under the License.
image: maven:3.3.9
pipelines:
default:
- step:
script:
- mvn -version
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var plumber = require('gulp-plumber');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');
var babel = require('gulp-babel');
//referencia do prompt
var bannerInstall;
if ('serviceWorker' in navigator){
navigator.serviceWorker
.register('sw.js')
.then(function () {
console.log('Service worker está registrado!');
});
}
@mnsmarcelo
mnsmarcelo / sw.js
Last active January 26, 2018 14:56
self.addEventListener('install', function (event) {
console.log('[Service Worker] Instalando Service Worker...', event);
});
self.addEventListener('activate', function (event) {
console.log('[Service Worker] Ativando Service Worker ...', event);
return self.clients.claim();
});
self.addEventListener('fetch', function (event) {
@mnsmarcelo
mnsmarcelo / app.js
Last active January 26, 2018 16:09
if ('serviceWorker' in navigator){
navigator.serviceWorker
.register('sw.js')
.then(function () {
console.log('Service worker está registrado!');
});
}
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Meu Primeiro PWA</title>
<link rel="shortcut icon" href="src/images/icons/favicon.png">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
{
"name": "Meu Primeiro PWA",
"short_name": "MP PWA",
"icons": [
{
"src": "src/images/icons/app-icon-48x48.png",
"type": "image/png",
"sizes": "48x48"
},
{
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Upload</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style>
.top-buffer { margin-top:20px; }
</style>
</head>
document.getElementsByClassName("btn")[0].addEventListener("click", function () {
var arquivos = document.getElementsByClassName("arquivos")[0].files;
var dados = new FormData();
var url = new XMLHttpRequest();
for (var i = 0; i < arquivos.length; i++) {
dados.append("arquivo[]", arquivos[i]);
}