Skip to content

Instantly share code, notes, and snippets.

View raco's full-sized avatar
🎸
Blues

Renato Centeno raco

🎸
Blues
View GitHub Profile
@raco
raco / rendermap.php
Created December 9, 2016 08:13
ACF: Render Map
<?php
$location = get_field('location');
if( !empty($location) ):
?>
<div class="acf-map">
<div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>"></div>
</div>
<?php endif; ?>
@raco
raco / wkhtmltopdf_wkhtmltoimage.md
Created April 12, 2017 17:42 — forked from isogram/wkhtmltopdf_wkhtmltoimage.md
How to manually install Wktohtmlpdf and Wkhtmltoimage in Ubuntu Server

How to Install Wkhtmltopdf and Wkhtmltoimage in Ubuntu

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar -xvf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
cd wkhtmltox/bin/
sudo mv wkhtmltopdf  /usr/bin/wkhtmltopdf
sudo mv wkhtmltoimage  /usr/bin/wkhtmltoimage
@raco
raco / validate_only_numbers.js
Created May 24, 2017 02:43
Validate only numbers
var last = '';
var telefono = document.getElementById('telefono');
telefono.addEventListener('input', function(e){
if (isNaN(e.target.value))
e.target.value=last;
else
last=e.target.value;
});
@raco
raco / steps_deploy_larave.md
Created June 7, 2017 00:02
Steps to deploy a laravel project

PASOS

  1. Crear el droplet

  2. Acceder por ssh

  3. Checkear las versiones 3.1 ps -ax | grep nginx

  4. Configurar nginx mkdir /var/www/laravel index.php

@raco
raco / remove_item_from_json.php
Created October 31, 2017 06:15
Query Builder remove item from json
\DB::table('faces')->where('id', $faceId)->update(['meta'=> \DB::raw("json_remove(meta, '$.{$request->index}')") ]);
@raco
raco / install-redis.sh
Created December 20, 2017 23:07 — forked from clzola/install-redis.sh
Bash script for installing Redis on Ubuntu 16.04
#!/bin/bash
# Install the Build and Test Dependencies
apt-get update
apt-get install -y curl build-essential tcl
# Download and Extract the Source Code
cd /tmp
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
@raco
raco / upgrade_php_7.0_7.2.sh
Last active August 17, 2019 22:16
Upgrade from PHP 7.0 to 7.2
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
(optional) sudo apt-get remove php7.0
sudo apt-get install php7.2;
sudo apt-get install php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-mbstring php7.2-xmlrpc php7.2-zip php7.2-curl
@raco
raco / deploy_git.sh
Last active April 4, 2020 00:23
Script to install a git bare repository to deploy easily
#!/bin/sh
#
export DEBIAN_FRONTEND=noninteractive;
# Define a project name
projectname='your_project_name';
cd /var/www;
mkdir $projectname;
cd /var;
@raco
raco / android_setup_linux.sh
Last active October 10, 2018 03:30
Ionic 2 - Android setup for Ubuntu
# Android SDK setup
## Install Java
```bash
sudo apt-get update
sudo dpkg --add-architecture i386
sudo apt-get install libbz2-1.0:i386
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1
# Si es ubuntu 14.04
@raco
raco / nginx_security_headers
Last active June 25, 2018 23:02
Nginx Security Headers
# Security headers
add_header Strict-Transport-Security "max-age=2592000; includeSubDomains; preload";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header Content-Security-Policy "default-src 'self' www.google-analytics.com ajax.googleapis.com www.google.com google.com gstatic.com www.gstatic.com connect.facebook.net facebook.com;";
add_header X-XSS-Protection "1; mode=block";
add_header Referrer-Policy "origin";
#https://developer.mozilla.org/es/docs/Web/HTTP/Headers/X-Frame-Options