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
@celsojr
celsojr / mapa_fila_banco.c
Last active June 17, 2016 08:49
Código criado para ajudar os amigos da faculdade de Engenharia de Software da UniCesumar que estão no outro módulo mais avançado na atividade MAPA. Link para a explicação em vídeo: https://youtu.be/JilpPJsmaOU
/*
* ////////////////////////// MAPA FILA BANCO //////////////////////////////
* Atividade MAPA desenvolvida para ajudar os amigos da faculdade UniCesumar
* Trata-se de uma simples implementação de um atendimento de uma fila
* de banco utilizando os recursos da fila encadeada da linguagem c
*
* Copyright(c) 2016 Celso Junior, celsojrfull@gmail.com
*
* Licensed under MIT-style license:
*
@celsojr
celsojr / MapaFilaBanco.cs
Last active June 20, 2016 02:05
Exemplo da atividade MAPA com a liguagem csharp
/*
* ////////////////////////// MAPA FILA BANCO C# //////////////////////////////
* Atividade MAPA desenvolvida para ajudar os amigos da faculdade UniCesumar
* Trata-se de uma simples implementação de um atendimento de uma fila de
* banco utilizando os recursos da linguagem c# 6
*
* Copyright(c) 2016 Celso Junior, celsojrfull@gmail.com
*
* Licensed under MIT-style license:
*
// F# calculating the factorial in imperative approach programming.
let Fact n =
let mutable x = n
let mutable y = 1
while x > 0 do
y <- y * x
x <- (x - 1)
y
for i in 0 .. 10 do
@celsojr
celsojr / Factorial_Functional.fs
Last active November 19, 2023 11:37
F# Tail Recursive Factorial in a functional programming approach
(*--------------------------------------------------------------------------------------------
* 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.
* F# Tail Recursive Factorial in a functional programming approach.
* Also using the CPS technique (Continuation Passing Style).
* Ref.: https://en.wikipedia.org/wiki/Continuation-passing_style
* --------------------------------------------------------------------------------------------*)
[<TailCall>]
let fac1 x =
open System
let (<->) x y = 2 * x + y = 1
let a = [ -1..5 ];; let b = [ -3..8 ];;
let axb = a |> List.collect (fun c -> b |> List.map (fun d -> c,d))
|> List.choose (fun (a,b) ->
match (a,b) with
| x when a <-> b -> Some(a,b)
| _ -> None)
/**
* Programa em Java para contar as ocorrências de cada letra em uma frase.
*
* @author Celso Jr
* @version Imperativa
*
*/
import java.io.*;
/*--------------------------------------------------------------------------------------------
* 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;
-- 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` ;
// 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()
{
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}");
}