Skip to content

Instantly share code, notes, and snippets.

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

Javier Castro jadark

🏠
Working from home
View GitHub Profile
//SCRIPT PARA CAMBIAR URLS EN WORDPRESS
//Con este script se actualiza las urls de la BD cuando se cambia de servidor un proyecto wordpress
//UPDATE wp_posts SET guid = replace(guid, 'URL_ACTUAL','URL_LOCAL');
UPDATE wp_posts SET guid = replace(guid, 'http://tuurldeproduccion.com.pe/','http://localhost/tuproyecto');
UPDATE wp_posts SET post_content = replace(post_content, 'http://tuurldeproduccion.com.pe/', 'http://localhost/tuproyecto');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://tuurldeproduccion.com.pe/', 'http://localhost/tuproyecto');
UPDATE wp_options SET option_value = replace(option_value, 'http://tuurldeproduccion.com.pe/', 'http://localhost/tuproyecto')
WHERE option_name = 'home' OR option_name = 'siteurl';
@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active February 20, 2024 10:00
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@tawanorg
tawanorg / $wpdb Insert Multiple Records.php
Last active June 7, 2018 22:07
use $wpdb Insert Multiple Records Wordpress
// Setup arrays for Actual Values, and Placeholders
$values = array();
$place_holders = array();
// Then loop through the the values you're looking to add, and insert them in the appropriate arrays:
foreach($_POST as $key => $value)
{
array_push($values, $value, $order_id);
$place_holders[] = "('%d', '%d')" /* In my case, i know they will always be integers */
}
@philfreo
philfreo / localstorage_safari_private_shim.js
Last active November 20, 2019 22:49
Don't let localStorage/sessionStorage setItem throw errors in Safari Private Browsing Mode
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem
// to avoid the entire page breaking, without having to do a check at each usage of Storage.
if (typeof localStorage === 'object') {
try {
localStorage.setItem('localStorage', 1);
localStorage.removeItem('localStorage');
} catch (e) {
Storage.prototype._setItem = Storage.prototype.setItem;
Storage.prototype.setItem = function() {};
@ashleydw
ashleydw / nginx.conf
Last active January 8, 2024 15:32
Laravel nginx conf file
server {
listen 80 default_server;
server_name example.com www.example.com;
access_log /srv/www/example.com/logs/access.log;
error_log /srv/www/example.com/logs/error.log;
root /srv/www/example.com/public;
index index.php index.html;
@Steven-Rose
Steven-Rose / gist:3943830
Created October 24, 2012 04:27
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.