This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.elepy.annotations.*; | |
import com.elepy.models.TextType; | |
@RestModel(slug = "/products", name = "Name") | |
public class Product { | |
@Identifier | |
private String id; | |
@Number(minimum = 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def abs(x: Double) = if (x > 0) x else -x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates a curried version of sum, where the | |
// first function is that to be applied to the input and the | |
// second function is the input | |
// (Int => Int) => (Int, Int) => Int | |
def sumCurry(f: Int => Int): (Int, Int) => Int = { | |
def sumF(a: Int, b: Int): Int = | |
if (a > b) 0 else f(a) + sumF(a + 1, b) | |
sumF | |
} |
OlderNewer