Skip to content

Instantly share code, notes, and snippets.

View era5mx's full-sized avatar

David Rengifo era5mx

View GitHub Profile
@era5mx
era5mx / express.js
Created February 10, 2020 09:11
Permite desplegar el bot en la plataforma de Heroku
/* BEGIN: fix deployment into heroku*/
const PORT = process.env.PORT || 3000;
const INDEX = '/docs/index.html';
let express = require('express');
//res.sendFile(INDEX, { root: __dirname })
const server = express()
.use((req, res) => res.sendFile(INDEX, { root: __dirname }))
.listen(PORT, () => logger.info(`Listening on ${PORT}`));
/* END: fix deployment into heroku*/
@era5mx
era5mx / permisos.js
Last active February 5, 2020 07:28
Arreglo con la lista de permisos que puedes usar para validar tus comandos al construir un bot para #Discord.
const permisos = [
'ADD_REACTIONS',
'ADMINISTRATOR',
'ATTACH_FILES',
'BAN_MEMBERS',
'CHANGE_NICKNAME',
'CONNECT',
'CREATE_INSTANT_INVITE',
'DEAFEN_MEMBERS',
'EMBED_LINKS',
@era5mx
era5mx / DateUtils.java
Created December 7, 2018 06:16
Utileria de fecha con Locale configurable en properties
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
@era5mx
era5mx / automatic-versioning.gradle
Last active November 24, 2018 12:01
Automatic versioning jar with gradle build tool. Place the code snippet of the automatic-versioning.gradle file in your build.gradle file. Valid values for UpgradeVersion are: Major, Minor, Patch or None.
compileJava{
doFirst {
def propertyFile = file "/version.properties"
def props = new Properties()
propertyFile.withReader { props.load(it) }
print "Actual Version: "
version = props.getProperty('MajorVersion') + '.' + props.getProperty('MinorVersion') + '.' + props.getProperty('PatchVersion') + '-' + props.getProperty('LabelVersion') + '(' + props.getProperty('BuildVersion') + props.getProperty('MajorVersion') + props.getProperty('MinorVersion') + props.getProperty('PatchVersion') + ")"
println("version = ${version}")
}
doLast {
@era5mx
era5mx / ColorNameEnum.java
Last active November 4, 2022 11:09 — forked from nightlark/gist:6482130
Java class to look up a color name from the rgb values.
/*
*
*/
/**
* The Enum Color.
*/
public enum ColorNameEnum {