Skip to content

Instantly share code, notes, and snippets.

View veggigit's full-sized avatar
🏠
Working from home

Esteban Cajina veggigit

🏠
Working from home
  • Santiago de Chile
View GitHub Profile
@javiertapia
javiertapia / jquery.validate.rut.js
Created February 16, 2009 14:03
Validar rut mediante jQuery.Validate
function validaRut(campo){
if ( campo.length == 0 ){ return false; }
if ( campo.length < 8 ){ return false; }
campo = campo.replace('-','')
campo = campo.replace(/\./g,'')
var suma = 0;
var caracteres = "1234567890kK";
var contador = 0;
@jrobinsonc
jrobinsonc / number-format.js
Last active July 23, 2021 22:09
Funcion para darle formato a un número. #javascript #numbers
function number_format(amount, decimals) {
amount += ''; // por si pasan un numero en vez de un string
amount = parseFloat(amount.replace(/[^0-9\.]/g, '')); // elimino cualquier cosa que no sea numero o punto
decimals = decimals || 0; // por si la variable no fue fue pasada
// si no es un numero o es igual a cero retorno el mismo cero
if (isNaN(amount) || amount === 0)
return parseFloat(0).toFixed(decimals);
@jaimeguaman
jaimeguaman / regex_celulares_chile
Last active June 21, 2024 02:58
regex validacion celulares chile
/^(\+?56)?(\s?)(0?9)(\s?)[98765432]\d{7}$/
@consti
consti / hosts
Last active June 7, 2024 13:12
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
@anareyna
anareyna / parsley_es.js
Last active November 26, 2021 20:50
How to use Parsley validation
// ParsleyConfig definition if not already set
window.ParsleyConfig = window.ParsleyConfig || {};
window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
window.ParsleyConfig.i18n.es = $.extend(window.ParsleyConfig.i18n.es || {}, {
defaultMessage: "Este valor parece ser inválido.",
type: {
email: "Ingrese un email válido.",
url: "Ingrese una URL válida.",
number: "Ingrese un número válido.",
[{"key":"1920 x 1080","name":"Nexus 5 Landscape","width":1920,"height":1080},
{"key":"1080 x 1920","name":"Nexus 5 Portrait","width":1080,"height":1920},
{"key":"1024 x 768","name":"iPad Landscape","width":1024,"height":768},
{"key":"768 x 1024","name":"iPad Portrait","width":768,"height":1024},
{"key":"736 x 414","name":"iPhone 6 Plus Landscape","width":736,"height":414},
{"key":"414 x 736","name":"iPhone 6 Plus Portrait","width":414,"height":736},
{"key":"667 x 375","name":"iPhone 6 Landscape","width":667,"height":375},
{"key":"375 x 667","name":"iPhone 6 Portrait","width":375,"height":667},
{"key":"568 x 320","name":"iPhone 5/S/C Landscape","width":568,"height":320},
{"key":"320 x 568","name":"iPhone 5/S/C Portrait","width":320,"height":568},
@vluzrmos
vluzrmos / compat_l5.php
Last active November 1, 2022 20:43
Lumen L5 compatibility helpers. That file should be added on root path of your project... and added to your composer.json
<?php
if(!function_exists('config_path'))
{
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path=null)
@JamieWritesCode
JamieWritesCode / default.conf
Created May 27, 2016 03:28
Nginx Configuration for Bedrock Multisite install on Laravel Forge
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/example.com/before/*;
server {
listen 80;
server_name example.com;
root /home/forge/example.com/web;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
@dsturm
dsturm / fix-wordpress-permissions.sh
Last active July 29, 2023 06:29 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions (for bedrock)
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_ROOT=$1 # <-- wordpress root directory
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
@vaibhavpandeyvpz
vaibhavpandeyvpz / ubuntu-16-vps-lamp.sh
Last active April 27, 2023 16:23
Install and setup LAMP stack + Composer on a clean Ubuntu 16.04 VPS
#!/usr/bin/env bash
APACHE_USER=wwwhost
VHOSTS_DOMAINS=(example.com second.example.com)
sudo ufw allow in "OpenSSH"
# Install Apache
sudo apt-get update
sudo apt-get install apache2
sudo nano /etc/apache2/apache2.conf # Add ServerName ... directive at bottom