Skip to content

Instantly share code, notes, and snippets.

@arodu
arodu / functions.js
Created June 7, 2018 14:09
Javascript general functions
// add new param to url
function update_url(url, key, value){
if(url.indexOf('?') !== -1){
return url + "&" + key + "=" + value;
}else{
return url + "?" + key + "=" + value;
}
}
@arodu
arodu / autosize.js
Created June 4, 2018 14:05
jquery autosize textarea
var text = $('#autosize');
text.on('change drop keydown cut paste', function() {
text.height('auto');
text.height(text.prop('scrollHeight'));
});
@arodu
arodu / install.sh
Created May 10, 2018 22:46
Instalar node-sass
sudo npm install node-sass -g --unsafe-perm
@arodu
arodu / debug.php
Last active May 9, 2018 11:38
Function debug in PHP
<?php
function debug($var, $return = false){
$trace = debug_backtrace();
foreach ($trace as $t) {
if($t['function'] == __FUNCTION__){
$file = $t['file'];
$line = $t['line'];
break;
}
@arodu
arodu / instalacion.md
Created March 8, 2018 14:01 — forked from pokisin/instalacion.md
Instalar LAMP en arch linux (Manjaro)

Pasos para instalar LAMP en Manjaro

  1. Abrimos la terminal y ejecutamos la siguiente linea para actualizar la base de datos de los paquetes
  sudo pacman -Syu
  1. Instalamos el apache y ejecutamos lo siguiente
  sudo pacman -S apache
@arodu
arodu / getParameter.js
Created August 13, 2017 15:01
javascript url getParameter
function getParameter(name) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0; i < vars.length; i++) {
var pair = vars[i].split("=");
if(pair[0] == name) {
return pair[1];
}
}
return false;
@arodu
arodu / autohide.sh
Created May 18, 2017 15:04
Toggle autohide: none / intelligent for xfce
#!/usr/bin/env bash
current=$(xfconf-query -c xfce4-panel -p /panels/panel-0/autohide-behavior)
if [[ "$current" == "1" ]]; then
current="0"
else
current="1"
fi
@arodu
arodu / color.sh
Created March 24, 2017 13:39 — forked from lordii/color.sh
Color in genmon (xfce plugin)
#pango markup
echo "<txt><span foreground=\"#667899\">Test</span></txt>"
@arodu
arodu / BootstrapFormHelper.php
Created November 18, 2016 20:41 — forked from trajakovic/BootstrapFormHelper.php
This file is taken from https://github.com/CCadere/CakePHP-Forms-Bootstrap-2.3-Helper/blob/master/View/Helper/BootstrapFormHelper.php, and slightly modified/extended. Added support for has-error bs3 validation error class.
<?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
*
* Licensed under The MIT License
*
* Copyright (c) La Pâtisserie, Inc. (http://patisserie.keensoftware.com/)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('FormHelper', 'View/Helper');
@arodu
arodu / ControllerTask.php
Last active November 18, 2016 17:44
Baking everything with scaffold
<?php
/**
Baking everything with scaffold
Source: http://www.rndmr.com/cakephp-tricks-baking-everything-with-scaffold-239
File: lib/Cake/Console/Command/Task/ControllerTask.php
How to use:
cake bake controller all --scaffold
*/