Skip to content

Instantly share code, notes, and snippets.

View geeksilva97's full-sized avatar
🏠
Working from home

Edy Silva geeksilva97

🏠
Working from home
View GitHub Profile
@geeksilva97
geeksilva97 / index.js
Created December 2, 2019 10:56
Functions used in Emulators
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
exports.addDate = functions.firestore.document('users/{userId}')
.onCreate(async (snapshot, context) => {
try {
return await admin.firestore().doc(snapshot.ref.path)
.update({
createdAt: 'today'
@geeksilva97
geeksilva97 / home.page.ts
Created February 18, 2020 15:33
SignIn with Google
import { Component } from '@angular/core';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
import 'package:flutter/material.dart';
import 'package:rating_dialog/src/widgets/rating_dialog.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
@geeksilva97
geeksilva97 / main.dart
Created March 8, 2020 14:38
Rating Dialog - main.dart
import 'package:flutter/material.dart';
import 'package:rating_dialog/src/screens/home_screen.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
import 'package:flutter/material.dart';
class RatingDialog extends StatefulWidget {
@override
_RatingDialogState createState() => _RatingDialogState();
}
class _RatingDialogState extends State<RatingDialog> {
int _stars = 0;
@geeksilva97
geeksilva97 / ProfileController.cs
Last active June 13, 2020 23:15
Uploading Files with progress monitoring in VanillaJS, Vue and Angular.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace UploadAPI.Controllers
{
@geeksilva97
geeksilva97 / form.html
Created June 14, 2020 01:48
Formulário
<form id="upload_form" enctype="multipart/form-data" method="post">
<input type="file" name="file1" id="file1"><br>
<progress id="progressBar" value="0" max="100" style="width:300px;"></progress>
<h3 id="status"></h3>
<p id="loaded_n_total"></p>
<hr />
<button type="submit">Enviar arquivo</button>
</form>
@geeksilva97
geeksilva97 / upload.js
Created June 14, 2020 01:57
Upload with Vanilla JS
function _(el) {
return document.getElementById(el);
}
function uploadFile() {
var file = _("file1").files[0];
// alert(file.name+" | "+file.size+" | "+file.type);
var formdata = new FormData();
formdata.append("file", file, "video.mov");
var ajax = new XMLHttpRequest();
@geeksilva97
geeksilva97 / Home.vue
Created June 14, 2020 02:07
VueJS Upload
<template>
<main>
<h2>VueJS File Upload</h2>
<form @submit="sendFile($event)" id="upload_form" enctype="multipart/form-data" method="post">
<input ref="inputFile" type="file" name="file1" id="file1"><br>
<progress ref="progressBar" id="progressBar" value="0" max="100" style="width:300px;"></progress>
<h3 id="status">{{ status }}</h3>
<p id="loaded_n_total">{{ progressText }}</p>
<hr />
<button type="submit">Enviar arquivo</button>
<h2>Angular File Upload</h2>
<form (submit)="sendFile()" id="upload_form" enctype="multipart/form-data" method="post">
<input #inputFile type="file" name="file1" id="file1"><br>
<progress #progressBar id="progressBar" value="0" max="100" style="width:300px;"></progress>
<h3 id="status">{{ status }}</h3>
<p id="loaded_n_total">{{ uploadStatus }}</p>
<hr />
<button type="submit">Enviar arquivo</button>
</form>