Skip to content

Instantly share code, notes, and snippets.

View joel-daros's full-sized avatar

Joel joel-daros

  • Blumenau, SC, Brazil
View GitHub Profile
@joel-daros
joel-daros / editprofile.ts
Last active June 4, 2018 19:44
[Angularfire] Upload the profile picture to Firestorage and then update user with downloadUrl
public cameraAvatar: string; //base64 image data get from camera
public profileForm: FormGroup; // reactive form data
saveProfile() {
if (this.profileForm.valid) {
let loader = this.loadingCtrl.create();
loader.present();
let toast = this.toastCtrl.create({
message: 'Data saved successfully',
@joel-daros
joel-daros / upload.js
Created September 10, 2018 14:00
Angularfire file upload
upload(path: string, file: File)
const storageRef = this._storage.ref(path);
const task = this._storage.upload(path, file);
return from(task).pipe(
switchMap((task: UploadTaskSnapshot) => storageRef.getDownloadURL())
);
}
@joel-daros
joel-daros / validaIE.sql
Last active August 2, 2019 12:32
Valida Inscrição Estadual por Estado em Oracle PL/SQL
CREATE OR REPLACE FUNCTION validaie(pp_estado VARCHAR2,
pp_nr_inscricao_estadual VARCHAR2)
RETURN VARCHAR2 IS
v_verificador VARCHAR2(50);
v_calculo NUMBER;
v_digito NUMBER;
FUNCTION soma_algebrica(p_valor NUMBER) RETURN NUMBER IS
@joel-daros
joel-daros / dropdown.jsx
Created March 25, 2022 17:20
Dropdown Joel Daros
/*
Prompt:
We have defined a basic dropdown via the Dropdown and DropdownItem components below, with example usage
in the ExampleNav component. The Dropdown and DropdownItem components have some problems, and also
have room for improvements (doesn't everything?) A couple items TODO here (make sure to explain with comments!)
0. How are you today? 😊
R: I'm great. :)
1. Please fix any obvious issues you see with the dropdown and then save your gist.
@joel-daros
joel-daros / stranger_bot.py
Created March 28, 2023 12:06 — forked from ryujimorita/stranger_bot.py
Stranger Bot Code
import sys
from typing import Tuple
from time import sleep
from datetime import time, datetime, timezone, timedelta
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from joblib import Parallel, delayed
# params
@joel-daros
joel-daros / react-ts.code-snippets
Last active October 14, 2023 17:44
VSCode React Typescript Snippets
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"React functional component": {
"scope": "typescript,typescriptreact",
@joel-daros
joel-daros / api.ts
Created April 1, 2024 15:00 — forked from DouglasdeMoura/api.ts
Tiny wrapper around fetch
// Extends the return of the HTTPError class
class HTTPError extends Error {
readonly response: any;
readonly status: number;
readonly statusText: string;
constructor(status: number, statusText: string, response: any) {
super(statusText);
this.status = status;
this.statusText = statusText;