Skip to content

Instantly share code, notes, and snippets.

View Horaddrim's full-sized avatar
👽
Seeking knowledge...

Horaddrim Horaddrim

👽
Seeking knowledge...
  • C-137
View GitHub Profile
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@Horaddrim
Horaddrim / Desgin-patterns.java
Created August 10, 2017 14:10
A simple demonstration of three of my favorites design pattens for Java | Kotlin apps :D
import Decorator.RedShapeDecorator;
import Facade.ShapeMaker;
import FacadeKt.ShapeMakerKt;
import Models.Shape;
import Factory.ShapeFactory;
public class Main
{
public static void main(String[] args)
{
public static ArrayList<Patio> getArrayListPatios()
{
try
{
Connection con = ConnectionFactory.getConnection();
//
// Cria e executa o comando SQL.
//
String SQL = "EXEC SPVERITHUS_RetornaPatios 0, '','A' "; // EXECUTA A SP PEGANDO PARAMETROS
Statement PS = con.createStatement();
const Patios = require('./models/Patios');
const patiosSchema = require('./models/patiosSchema');
const express = require('express');
const app = express();
const mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
mongoose.connect('mongodb://mongo/verithus');
const mongoose = require('mongoose');
let Schema = mongoose.Schema;
const PatiosSchema = new Schema({
IdPatio: Number,
NomPatio: String,
IndExclusao: String
});
const patiosSchema = require('./patiosSchema');
exports.InserePatios = function(IdPatio,NomPatio,IndExclusao)
{
var newPatio = new Patio(IdPatio,NomPatio,IndExclusao);
patiosSchema.create(
{
IdPatio: newPatio.IdPatio,
NomPatio: newPatio.NomPatio,
IndExclusao: newPatio.IndExclusao
const inverteString = (stringOriginal) =>
{
let aux = "";
let size = stringOriginal.length;
for(i = (size - 1); i <= (size) && i >=0; i--)
{
aux += stringOriginal[i];
//console.log(aux);
}
return aux;
@Horaddrim
Horaddrim / quicksortImplement.go
Last active August 17, 2017 20:29
A simple quicksort algorithm implementation :D And just for doc, I'm loving Golang! It's amazing!!! :D
package main
import (
"fmt"
"os"
"strconv"
)
func main(){
entrada := os.Args[1:]
@Horaddrim
Horaddrim / maps.go
Last active August 17, 2017 20:59
A simple implementation for a future project >:D
package main
import (
"fmt"
"os"
"strings"
)
@Horaddrim
Horaddrim / quicksort+concurrency.go
Created August 22, 2017 14:14
A simple demonstration of the power of channels, and a play with the quicksort algorithm
package main
import (
"fmt"
)
func separar(nums []int, i, p chan<- int, pronto chan<- bool) {
for _, n := range nums {
if n%2 == 0 {
p <- n