Skip to content

Instantly share code, notes, and snippets.

View joariasl's full-sized avatar

Jorge Arias joariasl

View GitHub Profile
/**
* All field in a FormPanel to readOnly
* @param {Ext.form.FormPanel} form
* @param {boolean} readOnly
* @returns {void}
*/
formReadOnlyAllFields: function(form, readOnly){
Ext.suspendLayouts();
form.getForm().getFields().each(function(field) {
field.setReadOnly(readOnly);
/**
* Add confirm message to Window
* @param {Ext.window.Window} win
* @returns {Boolean}
*/
windowCloseConfirm: function(win) {
// Dado a que no es asíncrono
if(win.closeConfirm){
win.closeConfirm = false;// Revertir estado para no mantener confirmación
return true;
@joariasl
joariasl / zsh.md
Last active October 1, 2015 07:06 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@joariasl
joariasl / cmus_to_file.sh
Last active March 28, 2020 20:23
cmus player playing now to temp file from OBS
#!/usr/bin/env sh
file=/tmp/cmus_playing.txt
while true
do
music=""
if cmus-remote -C status | grep -q playing; then
music=$(cmus-remote -Q | grep -e "tag title" -e "tag artist" | sed "s/^tag\s\w*\s//g" | sed "N;s/\n/ - /g")
if (( ${#music} > 0 )); then
music="Now playing: $music"
fi
@joariasl
joariasl / geoffgarside_mod.zsh-theme
Last active January 11, 2021 06:24
My ZSH Personal Theme mod (based on geoffgarside and robbyrussell)
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='${ret_status}%{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%} %(!.#.$) '
RPROMPT='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}git:("
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
@joariasl
joariasl / upload_pdf.php
Last active November 17, 2015 16:13
Guardar archivo en PHP (ejemplo, no resuelto conflicto de nombre)
<?php
if($_FILES['file']['type'] === 'application/pdf'){// Siendo 'file' el name del parametro recibido
$uploaddir = './var/';// Especificar ruta de destino en folder
$time_file = time();
$file_name = date('YmdHis', $time_file).'.pdf';
$uploadfile = $uploaddir . $file_name;//Nombre del archivo sera fecha
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {// Si guarda correctamente hacer
/* TODO - Archivo guardado */
echo "Archivo $file_name guardado correctamente";
}
@joariasl
joariasl / bash_arguments.sh
Last active January 6, 2016 17:46
Bash command line arguments parse
#!/bin/bash
showUsage() {
echo "Usage:
Usage instruction..."
}
if (( ${#@} == 0 )); then
showUsage
exit 1
@joariasl
joariasl / 100_ddns.sh
Last active October 27, 2016 04:38
DDNS DonWeb NetworkManager /etc/NetworkManager/dispatcher.d/100_ddns.sh
#!/bin/sh
INTERFACE=$1 # The interface which is brought up or down
STATUS=$2 # The new state of the interface
case "$STATUS" in
'up') # $INTERFACE is up
if [[ "$INTERFACE" == "enp6s0" && $(hostname -i | grep "192.168.1.2" | cut -d " " -f 1) ]]; then
curl -basic -u "USERNAME:PASSWORD" -d "modulo=dnsDinamico&archivo=dnsDinamico&clienteDeActualizacion=api&op=actualizarHosts&hostNames[]=xxxxddn1.donweb-homeip.net" "https://administracion.donweb.com/ws/api.php"
fi