Skip to content

Instantly share code, notes, and snippets.

View sigmasoldi3r's full-sized avatar

Pablo Blanco Celdrán sigmasoldi3r

View GitHub Profile
@sigmasoldi3r
sigmasoldi3r / ASCII.ts
Created January 18, 2020 13:22
Originally developed for the lexer of Papaya, now not needed since the replacement of the classical lexer by a regex matcher.Feel free to use it, in both Javascript and Typescript, it will provide you with nice names for character codes.
/*
Copyright Pablo Blanco Celdrán 2020
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:
The above copyright notice and this permission notice shall be included in all
@sigmasoldi3r
sigmasoldi3r / LinkedList.ts
Created January 17, 2020 17:46
A simple double-linked-list in typescript, with iteration included. This was a part of a project that was not needed at the end.
/*
Copyright Pablo Blanco Celdrán 2020
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:
The above copyright notice and this permission notice shall be included in all
@sigmasoldi3r
sigmasoldi3r / tuple.ts
Created December 2, 2019 16:59
Form 0-tuple to 26-tuple baking function with static assertion, elegant and simple of use.
/**
* Typesafe tuple making function.
*/
/**
* Creates a 0-tuple
*/
export function tuple(): [];
/**
@sigmasoldi3r
sigmasoldi3r / regen-repos.js
Created February 12, 2018 14:41
Regenerates entity repositories when using TypeORM
#!/home/lenovo/.node/bin/node
/**
* Regenrates the default repositories given a model.
*/
const fs = require('fs');
const program = require('commander');
const path = require('path');
const author = 'Pablo Blanco Celdran';
program
@sigmasoldi3r
sigmasoldi3r / regen-services.js
Created February 12, 2018 14:41
Regenerates services for accessing the repositories when using TypeORM
#!/home/lenovo/.node/bin/node
/**
* Regenrates the default repositories given a model.
*/
const fs = require('fs');
const program = require('commander');
const path = require('path');
const author = 'Pablo Blanco Celdran';
program
@sigmasoldi3r
sigmasoldi3r / http_method_badge_macro.tex
Created February 8, 2018 15:13
Creates a badge similar to shields.io, but bigger. It's intended to be used as HTTP api method reference (Left HTTP Verb, right relative path). Still WIP
% You should include tcolorbox libraries adn raster, with:
% \usepackage[raster]{tcolorbox}
% Also define your own colors or use from xcolor
% Usage is dead simple: \badge{color_and_verb}{relative_path}
% The name of the color is used as left part text! You should define aliases, like:
% \definecolor{POST}{HTML}{97CA00}
% \definecolor{GET}{HTML}{007EC6}
% \definecolor{PUT}{HTML}{DFB317}
% \definecolor{PATCH}{HTML}{9F9F9F}
@sigmasoldi3r
sigmasoldi3r / draconic-name.js
Last active April 1, 2020 13:43
Get your name in draconic
let f = (n) => [...n].map((x) => ~x.charCodeAt(0)).map((x) => String.fromCharCode(-x)).join('');
@sigmasoldi3r
sigmasoldi3r / expresso.bat
Last active March 31, 2017 10:28
This invokes the express generator and generates a batch to run your server with debugging, this avoids you having to copy and paste what express says at the end.
@ECHO OFF
set app_title=Expresso - An express generator invoker
set script_title=NodeJS Express Server
set script_name=server.bat
title %app_title%
for %%f in (%cd%) do set workd=%%~nxf
echo Generating batch output for /%workd%/
@sigmasoldi3r
sigmasoldi3r / dir-tree.js
Last active March 17, 2020 12:40
Asynchronous directory tree builder
'use strict';
const fs = require('fs');
module.exports = (path, solver) => {
fs.readdir(path, (err, childs) => {
let prom = childs.map((child) => {
return new Promise((r, j) => {
fs.stat(`${path}/${child}`, (err, stats) => {
if (stats.isDirectory()){