Skip to content

Instantly share code, notes, and snippets.

View almeidaalex's full-sized avatar
🦖
Focusing

Alex Alves de Almeida almeidaalex

🦖
Focusing
View GitHub Profile
@almeidaalex
almeidaalex / Dockerfile
Created October 23, 2024 20:24
Exception API
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
# Copy the project file and restore dependencies
COPY *.csproj ./
RUN dotnet restore
# Copy the rest of the application and build it
COPY . ./
RUN dotnet publish -c Release -o out
@almeidaalex
almeidaalex / sql
Last active October 28, 2022 13:10
group by month and year
select format(created_at, 'MM.yyyy') as created_at
, sum(tolerance) as t_sum
, sum(measured_value) as t_measure
from ncr_tickets as n
group by format(created_at, 'MM.yyyy')
Ncr::NcrTicket
.select("sum(tolerance) as tolerance, sum(measured_value) as measured_value, format(created_at, 'MM.yyyy') as created_at")
.group("format(created_at, 'MM.yyyy')")
@almeidaalex
almeidaalex / Capitulo10.cs
Last active December 11, 2020 22:00
Autenticação por cookies
/*
7. No método Autentica dentro do UsuarioController , se o model estiver válido, use o método
Busca para verificar se o usuário existe. Se existir, coloque o usuário na sessão do servidor antes de
redirecionar para a action Index do PostController . Caso contrário, mostre novamente o
formulário de login com a seguinte mensagem de erro "Login ou senha incorretos" :
*/
public async Task<IActionResult> Autentica(LoginViewModel login, string returnUrl = null)
{
if (ModelState.IsValid)
@almeidaalex
almeidaalex / index.html
Last active August 29, 2015 14:16
Open native AngularJS popover with text/ng-template
<!DOCTYPE html>
<html ng-app="pop" >
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="bower_components/angularjs/angular.js"></script>
<script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="bower_components/angular-bootstrap/ui-bootstrap.js"></script>
<script type="text/javascript" src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">