AVVERTIMENTO: Tutti i frammenti di codice presenti in questo aritcolo non sono in nessun particolare linguaggio ma sono verosimili (vd. Manzoni).
WIP: Work In Progress, non leggere le cose contrassegnate con questo
interface Editor { | |
val carretPosition: Vec2i | |
val selectionLength: Int | |
fun putChar(char: Char) | |
fun putString(string: String) | |
fun putColor(position: Vec2i, length: Int, forecolor: Color, backcolor: Color) |
/* | |
A small library that adds a template engine and a one way binding mechanism. All in 200 lines of code. | |
*/ |
/** | |
* Created by aziis98 on 29/11/2016. | |
* Copyright 2016 Antonio De Lucreziis | |
*/ | |
fun <T> split(source: List<T>, predicate: (T, T) -> Boolean): List<List<T>> { | |
fun _split(predicate: (T, T) -> Boolean, acc: List<List<T>>, source: List<T>): Pair<List<List<T>>, List<T>> { | |
if (acc.isEmpty()) { | |
val a = source[0] | |
val b = source[1] |
function fromTemplate(templateId, data) { | |
data = data || {}; | |
const templateCode = $('#' + templateId).html(); | |
const compiledTemplate = templateCode | |
.replace(/\{\{(.+?)\}\}/g, function (match, code) { | |
return (function() { | |
return eval(code); | |
}.bind(data)()); |
class BasicScanner(val source: String, var carret: Int = 0) { | |
fun jumpAll(predicate: (Char) -> Boolean): String { | |
return StringBuilder().apply { | |
var current = seeNextChar() | |
while (predicate(current)) { | |
append(current) | |
carret++ | |
if (hasMore()) | |
current = seeNextChar() |
MIT License | |
Copyright (c) 2017 Antonio De Lucreziis | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
MIT License | |
Copyright (c) 2017 Antonio De Lucreziis | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
MIT License | |
Copyright (c) 2017 Antonio De Lucreziis | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
AVVERTIMENTO: Tutti i frammenti di codice presenti in questo aritcolo non sono in nessun particolare linguaggio ma sono verosimili (vd. Manzoni).
WIP: Work In Progress, non leggere le cose contrassegnate con questo