Skip to content

Instantly share code, notes, and snippets.

View mager19's full-sized avatar

Mario Germán Reyes C mager19

View GitHub Profile

Pasos para sincronizar dbs

  • Exportar la db en local y ponerla en una carpeta, ir a esa carpeta en la terminal para copiarla via ssh
  • Copia el archivo usando el siguiente comando
    scp -r walk.sql [email protected]:/var/www/html/ tener presente el nombre del archivo y que debe ir en el directorio public o html
  • conectarse al droplet via ssh y ejecutar el siguiente comando para importar la db
    mysql -u wordpress -p wordpress < walk.sql donde el primer parametro es el nombre de usuario, el segundo el nombre de la db y el tercero el archivo q acabamos de importar, esta info la puedes obtener asi: nano wp-config.php o grep 'define' wp-config.php
# in the folder where is the files do - Change 104.248.34.58 for you ip
scp -r walk.sql.gz [email protected]:/var/www/html/wp-content
@mager19
mager19 / digital ocean
Last active February 6, 2023 14:10
Install droplet WordPress Digital Ocean
// install filezilla
sudo apt-get update
sudo apt-get install filezilla
// Crear Alias .zshrc
alias knito="ssh -tp 22 [email protected] 'cd ../var/www/html; bash'"
//Permisos
sudo chown -R www-data:www-data /var/www/html
@mager19
mager19 / gist:6f5b977e8dcc1a340729e19ea54ac4a9
Created December 20, 2022 20:21
Reverse query relationship acf field
//obtain pages or post who added a relationship item - Reverse relationship posts
$tasks = get_posts(array(
'post_type' => 'task',
'meta_query' => array(
array(
'key' => 'task_parents', // name of custom field
'value' => '"' . get_the_ID() . '"', // matches exaclty "123", not just 123. This prevents a match for "1234"
'compare' => 'LIKE'
)
alias cl="clear"
alias dev="ssh -tp 22 [email protected] 'cd webapps; bash'"
alias rc1="ssh -tp 22 [email protected] 'cd webapps; bash'"
alias rc2="ssh -tp 22 [email protected] 'cd webapps; bash'"
alias rc3="ssh -tp 22 [email protected] 'cd webapps; bash'"
alias rc4="ssh -tp 22 [email protected] 'cd webapps; bash'"
alias rc5="ssh -tp 22 [email protected] 'cd webapps; bash'"
alias rc6="ssh -tp 22 [email protected] 'cd webapps; bash'"
alias sp5="ssh -tp 22 [email protected] 'cd apps; bash'"
alias sp3="ssh -tp 22 [email protected] 'cd apps; bash'"
@mager19
mager19 / populate
Created May 9, 2022 19:49
populate a field, el 'emaito' es el parametro de populate q se setea.
add_filter('gform_field_value_emailto', 'add_job_email');
function add_job_email($value)
{
global $post;
$id = $post->id;
$email = get_field('email_to', $id);
return $email;
}
@mager19
mager19 / functions.php
Created March 31, 2022 14:52
assing value to hidden field pre submittion
add_filter("gform_pre_submission_1", "obtainsumvaluesfield", 1);
function obtainsumvaluesfield($form)
{
// get all entries in this form
$entry = GFFormsModel::get_current_lead();
$all = 0;
foreach ($form["fields"] as &$field)
if ($field->type == 'checkbox') {
@mager19
mager19 / functions.php
Created June 3, 2021 20:35
send email on time check
add_action('gform_after_submission', 'set_post_content', 10, 2);
function set_post_content($entry, $form)
{
//vars
$id = $entry['form_id'];
if ($id == '3' || $id == '1' || $id == '10' || $id == '16') {
$date = new DateTime();
$date->setTimezone(new DateTimeZone('America/Chicago'));
10k e951
10mp e952
11mp e953
12mp e954
13mp e955
14mp e956
15mp e957
16mp e958
17mp e959
18mp e95a
@mager19
mager19 / config visual code
Created October 9, 2020 17:07
backup visual
test