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
create or replace view api.consultoria_remessa_meses(ano, mes) as | |
SELECT c.ano, | |
c.mes::integer AS mes | |
FROM ( SELECT date_part('year'::text, CURRENT_DATE) AS ano, | |
to_char(a.datas::timestamp with time zone, 'mm'::text) AS mes | |
FROM ( SELECT date_trunc('month'::text, datas.datas)::date AS datas | |
FROM generate_series((date_part('year'::text, CURRENT_DATE)::text || '-01-01'::text)::timestamp without time zone, (date_part('year'::text, CURRENT_DATE)::text || '-12-01'::text)::timestamp without time zone, '1 mon'::interval) datas(datas)) a | |
WHERE date_part('month'::text, a.datas) >= (date_part('month'::text, CURRENT_DATE) - 6::double precision) | |
UNION | |
SELECT date_part('year'::text, CURRENT_DATE) + 1::double precision AS ano, |
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
/** | |
* Como obter datas retroativas usando o bloco de código, Looping | |
*/ | |
do | |
$$ | |
begin | |
for i in 1 .. 365 loop | |
raise notice '%', current_date - i || 'T00:00:00.000Z'; |
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
resizeImage(base64Str, maxWidth = 400, maxHeight = 350) { | |
return new Promise((resolve) => { | |
let img = new Image() | |
img.src = base64Str | |
img.onload = () => { | |
let canvas = document.createElement('canvas') | |
const MAX_WIDTH = maxWidth | |
const MAX_HEIGHT = maxHeight | |
let width = img.width | |
let height = img.height |
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
/** | |
* @author: Oberdan Brito | |
* @copyright 2021 Craos.NET | |
* @description Exemplo de upload usando NodeJS | |
* @license MIT | |
* @site Para visualizar o código completo acess: https://github.com/OberdanBrito/Upload-com-NodeJS | |
*/ | |
const Config = require('./config') | |
const express = require('express') |
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
async ObtemConteudodoEmail() { | |
let parser = new DOMParser(); | |
this.doc = parser.parseFromString(this.editor.getContent(), 'text/html'); | |
let imagens = Array.from(this.doc.getElementsByTagName('img')) | |
await Promise.all(imagens.map(async (elemento) => { | |
elemento.src = await this.ModificaImagem(elemento.src) |
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
UploadImagens(Conteudo) { | |
return new Promise((resolve) => { | |
fetch(Conteudo) | |
.then(res => res.blob()) | |
.then(res => { | |
let fd = new FormData(); | |
fd.append("blob", res, `${''.uuid()}.${Conteudo.substring("data:image/".length, Conteudo.indexOf(";base64"))}`); | |
fetch(this.upload, { |
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
{ | |
"require": { | |
"monolog/monolog": "2.1.*", | |
"craos/pgdump": "0.1.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
internal class HardwareInfo | |
{ | |
public string PortName { get; internal set; } | |
public string Description { get; internal set; } | |
public string SystemName { get; internal set; } | |
public override string ToString() { | |
return $" SystemName: {SystemName}\r\n Description:{Description}\r\n PortName:{PortName}"; | |
} |
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
static void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) | |
{ | |
Console.WriteLine($"Serial recebido"); | |
string RxString = _serialPort.ReadExisting(); | |
string SerialID; | |
if (RxString.IndexOf("\r\n") > -1 || RxString.IndexOf("|") > -1) | |
{ | |
SerialID = RxString.Replace("\r\n", "").Replace("|", ""); | |
Console.WriteLine($"Serial: {SerialID}"); |
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
static void SerialPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e) | |
{ | |
Console.WriteLine($"Erro do sistema serial {e.ToString()}"); | |
} |