Skip to content

Instantly share code, notes, and snippets.

View PRElias's full-sized avatar
🎯
Focusing

Paulo Roberto Elias PRElias

🎯
Focusing
View GitHub Profile
@PRElias
PRElias / getElements.js
Created July 21, 2020 13:44
getelEments
let elements = document.querySelectorAll('table');
for (let elem of elements) { console.log(elem.innerHTML);}
@PRElias
PRElias / IAuditoria.cs
Last active July 6, 2020 11:53
C# auditoria
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Models
{
public interface IAuditoria
{
DateTime? DataCriacao {get; set;}
string LoginCriacao {get; set;}
@PRElias
PRElias / print.css
Created April 28, 2020 17:29
Ajustes mais comuns para impressão
/* Removendo cabeçalho e rodapé automático de impressão */
@page {
margin: 0;
}
body {
color: #000;
background-color: #fff;
}
@PRElias
PRElias / print-block.css
Last active April 28, 2020 17:29
CSS bloqueando impressão do browser
@media print {
body > *:not(#container) {
display: none;
}
body:after {
content: str-insert($string: "Para imprimir é necessário utilizar o botão em tela", $insert: "", $index: 0);
}
}
@PRElias
PRElias / GetNumeric.sql
Created April 11, 2019 16:04
SQL Server GetNumeric function
/****** Object: UserDefinedFunction [dbo].[GetNumeric] Script Date: 11/04/2019 11:51:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[GetNumeric]
(@strAlphaNumeric VARCHAR(256))
RETURNS VARCHAR(256)
@PRElias
PRElias / sql_server_all_fields.sql
Created April 11, 2019 14:35
SQL Server all fields
SELECT SchemaName = c.table_schema,
TableName = c.table_name,
ColumnName = c.column_name,
DataType = data_type,
Validate = 'SELECT TOP 1 ' + c.column_name + ' FROM ' + c.table_name
FROM information_schema.columns c
INNER JOIN information_schema.tables t
ON c.table_name = t.table_name
AND c.table_schema = t.table_schema
AND t.table_type = 'BASE TABLE'
@PRElias
PRElias / sql_server.sql
Created February 19, 2019 18:36
SQL Server útil
--Maiores tabelas
SELECT
t.NAME AS Entidade,
p.rows AS Registros,
SUM(a.total_pages) * 8 AS EspacoTotalKB,
SUM(a.used_pages) * 8 AS EspacoUsadoKB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS EspacoNaoUsadoKB
FROM
sys.tables t
INNER JOIN
-- Get ALTER TABLE Script for all tables to Enable all constraints for database
SELECT distinct 'ALTER TABLE [' + s.name + '].[' + o.name + '] WITH CHECK CHECK CONSTRAINT all'
FROM sys.foreign_keys i
INNER JOIN sys.objects o ON i.parent_object_id = o.OBJECT_ID
INNER JOIN sys.schemas s ON o.schema_id = s.schema_id
GO
-- Get ALTER TABLE Script for all tables to Disable all constraints for database
SELECT distinct 'ALTER TABLE [' + s.name + '].[' + o.name + '] NOCHECK CONSTRAINT all'
@PRElias
PRElias / web.php
Created September 10, 2018 12:16
Laravel log on browser
Route::get('/laravellog', function () {
$file = storage_path() . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . 'laravel.log';
$data = file($file);
$currentLine = count($data) - 1000;
if($currentLine < 0){
$currentLine = 0;
}
while($currentLine <= count($data) - 1){
SELECT deqs.last_execution_time AS [Time], dest.text AS [Query], dest.*
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC