Skip to content

Instantly share code, notes, and snippets.

View edgarMejia's full-sized avatar
:octocat:
Valiending

Edgar Mejía edgarMejia

:octocat:
Valiending
View GitHub Profile
$('#selUser').select2('readonly', true); // DESHABILITANDO UN SELECT2
// PASANDO UNA LISTA A UN SELECT2
var ids = tableDetail.column(0).data().toArray();
initAsyncSelect2('selUser', CONSTANTS.routes.users.list, CONSTANTS.lang.users.rolePlaceholder,false, function () {
return { idUsersWithRoles: JSON.stringify(ids) }; // getting the id's
});
// Convertir todo la data de una tabla en un array
table.data().toArray();
// OBETENER UNA COLUMNA EN ESPECIFICO COMO ARRAY
var ids = table.column(0).data().toArray();
// Boolean, si la tabla especificada es dt o no.
$.fn.DataTable.isDataTable('#table_permission_days');
// Integer Para saber si la tabla esta vacía
// Convertir un número negativo en positivo. // = 1
Math.abs(-1);
// revisar que un objeto no sea nulo cuando es pasado como paramétro
Long days = getDateDiff(Objects.requireNonNull(Time.parseStringToDate(date)), today);
// Obtener el int de un mes a partir de una fecha.
java.util.Date date= new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(date);

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@edgarMejia
edgarMejia / Utils regex
Created September 10, 2019 20:06
Regex to evaluate dates.
10/10/19
^\d{1,2}\/\d{1,2}\/\d{4}$
^\d{2}\/\d{2}\/\d{4}$ --> dd/MM/yyyy
^\d{1}\/\d{1}\/\d{4}$ --> d/M/yyyy
^\d{1}\/\d{2}\/\d{4}$ --> d/MM/yyyy
^\d{2}\/\d{1}\/\d{4}$ --> dd/M/yyyy
^\d{2}\/\d{2}\/\d{2}$ --> dd/MM/yy
// Catch valores nulos
disabledUsersOnLDAP.stream()
.map(User::getUsername)
.map(usersRepository::findEnabledByUsername)
.filter(Objects::nonNull) // <-- Util
.forEach(userEntity -> userEntity.setEnabled(false));
// Obtener el número máximo de una lista
Integer lastPaysheetPaymentId = lst.stream()
.mapToInt(VwRecalculatedRent::getPaysheetPaymentDetailId)
import psycopg2
import psycopg2.extras
from flask_csv import send_csv
@app.route("/fake", methods=["GET"])
def fake():
desde = "01/01/2020"
hasta = "25/05/2020"
tipo = "whatsapp"
SLACK_WORKSPACE_URL = app.config.get("SLACK_WORKSPACE_URL")
@edgarMejia
edgarMejia / instructions.md
Created March 27, 2024 22:20 — forked from DakotaLMartinez/instructions.md
Adding an SSH key to GitHub (Mac OS X or Linux)

You need to do this if you try this command:

ssh -T git@github.com

and you get something that says

git@github.com: Permission denied (public key).

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.