Skip to content

Instantly share code, notes, and snippets.

View eduwass's full-sized avatar
❄️
working remotely

Edu Wass eduwass

❄️
working remotely
View GitHub Profile
@eduwass
eduwass / duplicate-post.php
Last active April 9, 2024 05:32
Programmatically duplicating a WordPress post
<?php
/**
* Duplicates a post & its meta and returns the new duplicated Post ID.
*
* @param int $post_id The Post ID you want to clone.
* @return int The duplicated Post ID.
*/
function duplicate_post(int $post_id): int
{
@eduwass
eduwass / docker-compose.yml
Last active December 31, 2023 00:31
Mailhog + WordPress in docker-compose.yml
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@eduwass
eduwass / readme.md
Last active August 24, 2023 01:51
force 5g wifi on mac

Force 5 GHz WiFi Connection on macOS

If you're experiencing issues with your Mac connecting to the slower 2G band on routers that share SSID between 5G/2G (like the Google Wifi Nest), here's a guide to help you force a 5 GHz connection.

Identifying the 5G Channel

  1. Check Current Band: Hold option and click on the wifi icon on the macOS status bar. This will display the band you are currently connected to.
  2. Scan WiFi Channels: Use the following command to list all channels your WiFi is operating on:
    /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport scan
@eduwass
eduwass / example.html
Last active August 10, 2023 04:07
pdf to text using pdfjs
<!DOCTYPE html>
<html>
<head></head>
<body>
<input type="file" id="pdf-upload" accept=".pdf" />
<h1>Text will go here</h1>
<div class="pdf-text" id="pdf-text"></div>
<script src="https://mozilla.github.io/pdf.js/build/pdf.js"></script>
@eduwass
eduwass / functions.php
Created September 18, 2015 13:54
ACF Post Object field and WPML (show posts of both languages => disabling filtering)
<?php
/* Customize the ACF Post Object queries, so they return posts in both languages */
function customize_acf_query( $args, $field, $post )
{
if($field['type']=='post_object'){
$args['orderby'] = 'title';
$args['suppress_filters'] = true; // Suppress filters so WPML doesn't filter to only 1 lang
return $args;
}
@eduwass
eduwass / README.md
Last active September 5, 2022 08:02
Rize → Conjure

Connect Rize data with Conjure

The general idea is that this will run as a task at the end of a day, which will copy the following measures from Rize to Conjure for that day:

  • workHours
  • trackedTime
  • focusTime
  • meetingTime
  • breakTime

I used Pipedream for convenience, but with general Javascript knowledge you should also be able to easily use this outside of it.

@eduwass
eduwass / aux-functions.php
Last active August 11, 2022 05:21
Programmatically adding a Page item to a Wordpress nav menu
<?php
/**
* Adds Page to a WordPress navmenu
* @param [int] $page_id The ID of the page you want to add
* @param [str] $page_title Title of menu item
* @param [int] $menu_id NavMenu ID
* @param [int] $parent (Optional) Menu item Parent ID
*/
function add_page_to_menu($page_id, $page_title, $menu_id, $parent = 0){
@eduwass
eduwass / iStat Menus Settings.ismp
Created December 13, 2018 15:58
iStat menus settings
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>build</key>
<real>1087</real>
<key>license</key>
<dict>
<key>email</key>
<string>eduwass@gmail.com</string>
@eduwass
eduwass / gulpfile.js
Created November 23, 2015 10:04
Gulp task to SSH into production server and retrieve mysqldump
////////////////////////////////////////////////////////////////////
// Run: 'gulp download-db' to get latest SQL dump from production //
// File will be put under the 'dumps' folder //
////////////////////////////////////////////////////////////////////
// Load stuff
'use strict'
var gulp = require('gulp')
var GulpSSH = require('gulp-ssh')
var fs = require('fs');
@eduwass
eduwass / readme.md
Created December 7, 2021 16:36
BUG <Medium>: React capturing traffic on separate GA Instance

Detected on

PRODUCTION

Description

Originally, we had separate GA Instances for Blog and WP:

CleanShot 2021-12-07 at 16.30.01.png