Skip to content

Instantly share code, notes, and snippets.

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

Celso Jr celsojr

🏠
Working from home
View GitHub Profile
// DELETE api/v1/author/{authorId}
/// <summary>
/// Deletes an Author
/// </summary>
/// <remarks>Deletes an Author</remarks>
/// <param name="authorId"></param>
[HttpDelete("{authorId:length(24)}", Name = nameof(DeleteAuthor))]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(DeleteModel<>), StatusCodes.Status200OK)]
public async Task<IActionResult> DeleteAuthor(string authorId)
@celsojr
celsojr / JsonFromQuery.sql
Last active June 11, 2020 00:15
Generating a Json file from a SQL query
DECLARE @Participantes TABLE
(
Numero INT
)
INSERT INTO @Participantes VALUES (1), (2), (3)
DECLARE @RESPONSAVEL_TECNICO INT = 1
DECLARE @TRUE INT = 1
DECLARE @PRINCIPAL INT = 1
@celsojr
celsojr / ExcludeXmlNode.ps1
Last active March 28, 2020 15:11
Exclude a node containing a specific text in it with PowerShell
# sample.xml file content
# <file>
# <categories>
# <category>cat1</category>
# <category>cat2</category>
# <category>removecategory</category>
# <category>keepthisone</category>
# <category>deletethisone</category>
# <category>somethingelse</category>
# </categories>
@celsojr
celsojr / ExcludeXmlNode.cs
Last active March 28, 2020 15:12
Exclude a node containing a specific text in it with Csharp
// CSharp https://dotnetfiddle.net/jjMC07
using System;
using System.Linq;
using System.Xml.Linq;
using System.Xml.XPath;
public class Program
{
public static void Main()
{
/*--------------------------------------------------------------------------------------------
* Copyright (c) 2019 Celso Junior, All rights reserved.
* Licence: Copy 'n paste freed! \o/
* Description: Csharp program benchmarking the best place to use .ToList() method
* --------------------------------------------------------------------------------------------*/
using System;
using System.Linq;
using System.Collections.Generic;
using System;
public class Program
{
public static void Main()
{
for (int i = 0, x = 1; i <= 10; i++, x*=i)
{
Console.WriteLine($"{i:D2}! - {x}");
}
// C# function to calculate the factorial of a given number.
using System.Linq;
using System.Collections.Generic;
using static System.Console;
public class Program
{
public static void Main()
{
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mapa_exemplo
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `mapa_exemplo` ;
/*--------------------------------------------------------------------------------------------
* Copyright (c) 2017 Celso Junior, celsojrfull@gmail.com. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Inspired by Matrix Rain: https://www.codeproject.com/Articles/113227/Matrix-Rain
* --------------------------------------------------------------------------------------------*/
namespace Matrix
{
using System;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
/**
* Programa em Java para contar as ocorrências de cada letra em uma frase.
*
* @author Celso Jr
* @version Imperativa
*
*/
import java.io.*;