Skip to content

Instantly share code, notes, and snippets.

View RyanSusana's full-sized avatar

Ryan Susana RyanSusana

View GitHub Profile
import com.elepy.annotations.*;
import com.elepy.models.TextType;
@RestModel(slug = "/products", name = "Name")
public class Product {
@Identifier
private String id;
@Number(minimum = 0)
import com.elepy.Elepy;
import com.elepy.admin.ElepyAdminPanel;
import com.mongodb.DB;
import com.mongodb.MongoClient;
public class Main {
public static void main(String[] args) {
MongoClient mongoClient = someMongoClientWithConfiguration; // Configure your MongoClient
@RyanSusana
RyanSusana / tableInformation.sql
Last active May 7, 2019 11:18
MSSQL Utility Procedures for Database Integration
USE [master]
-- The table information custom type
CREATE TYPE TableInfo as table
(
TABLE_CATALOG nvarchar(128),
TABLE_SCHEMA nvarchar(128),
TABLE_NAME nvarchar(128),
TABLE_TYPE varchar(10)
create database [test Coo];
go
use [test Coo];
go
CREATE TABLE [imp_tbl_calc_mc] ([urencalculatieid] [int] NULL,[mcid] [int] NOT NULL,[type] [nvarchar](4) NULL,[artikelnummer] [nvarchar](30) NULL,[omschrijving] [nvarchar](60) NULL,[aantal] [float] NULL,[pins] [int] NULL,[tijd] [int] NULL,[opmerking] [nvarchar](MAX) NULL,[iqbs_timestamp] [datetime] NULL,[iqbs_processed] [bit] NOT NULL,[iqbs_operation] [varchar](1) NULL,[iqbs_connector] [varchar](20) NULL);CREATE TABLE [imp_tbl_calc_tijden] ([id] [int] NOT NULL,[categorie] [nvarchar](15) NULL,[processtap] [int] NULL,[aktiviteit] [nvarchar](50) NULL,[tijd] [float] NULL,[man] [int] NULL,[machine] [int] NULL,[iqbs_timestamp] [datetime] NULL,[iqbs_processed] [bit] NOT NULL,[iqbs_operation] [varchar](1) NULL,[iqbs_connector] [varchar](20) NULL);CREATE TABLE [imp_tbl_calc_notities] ([id] [nvarchar](2) NOT NULL,[notitie] [varchar](MAX) NULL,[medewerker] [nvarchar](30) NULL,[iqbs_timestamp] [datetime] NULL,[iqbs_processed] [bit] NOT NULL,[iqbs_operation] [varchar](1)
public static void main(String[] args) {
MongoClientURI uri = new MongoClientURI("uri");
MongoClient mongoClient = new MongoClient(uri);
final Elepy elepy = new Elepy()
.addConfiguration(AdminPanel.newAdminPanel())
.addModel(Products.class)
.onPort(7070);
@RyanSusana
RyanSusana / week1.scala
Last active June 2, 2020 13:41
ScalaWeek1
// Excercise 1
def pascal(c: Int, r: Int): Int =
if (c == 0 || r == c) 1 else pascal(c - 1, r - 1) + pascal(c, r - 1)
// Excercise 2
def balance(chars: List[Char]): Boolean = {
def loop(i: Int, amountOpen: Int): Boolean =
if (i >= chars.size) amountOpen == 0
else if (amountOpen < 0) false
def abs(x: Double) = if (x > 0) x else -x
def sqrt(x: Double): Double = {
def abs(x: Double) = if (x > 0) x else -x
def isGood(guess: Double, x: Double): Boolean =
abs(guess * guess - x) < 0.0001
def improve(guess: Double, x: Double) =
(guess + x / guess) / 2
def sqrtIter(x: Double, guess: Double): Double =
// Returns the input
def identity(x: Int) = x
// Calculates cube of a number
def cube(x: Int) = x * x * x
// Calculates factorial of a number
def factorial(x: Int): Int =
if (x <= 1) 1 else x * factorial(x - 1)
//Wraps all operands with a high-order function (the f parameter)
def sum(f: Int => Int, a: Int, b: Int): Int =
if (a > b) 0 else f(a) + sum(f, a + 1, b)
// Create a cubical sum of all ints from a to b
def sumCube(a: Int, b: Int) = sum(cube, a, b)
// Same for factorial
def sumFactorial(a: Int, b: Int) = sum(factorial, a, b)