Skip to content

Instantly share code, notes, and snippets.

View aziis98's full-sized avatar

Antonio De Lucreziis aziis98

View GitHub Profile
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)
@aziis98
aziis98 / PocketBinder.js
Last active August 16, 2016 23:18
A small library that adds a template engine and a one way binding mechanism. All in about 100 lines of code. (TODO: Add list/objects iterators)
/*
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]
@aziis98
aziis98 / pocket-templater.js
Created December 18, 2016 20:12
A very 14 line long template parser with handlebars like syntax. Requires jquery
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)());
@aziis98
aziis98 / BasicScanner.kt
Last active March 2, 2017 23:00
An alternative to the common java Scanner class in Kotlin
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:
@aziis98
aziis98 / LICENSE
Created August 9, 2017 00:20
Template of Webpack with Sass
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:
@aziis98
aziis98 / LICENSE
Last active September 10, 2017 15:42
Rue, a mini Vue like canvas helper/library/framework
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:
@aziis98
aziis98 / intro-alla-programmazione.md
Last active September 24, 2017 00:54
Una breve introduzione alla programmazione

Una breve introduzione alla programmazione

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

Intro

La parte deprimente (può essere saltata)

Esercizi del 25 Ottobre 2017

...