Skip to content

Instantly share code, notes, and snippets.

@alpual
alpual / wp-enqueue-resources.php
Last active October 5, 2020 23:29
Wordpress Enqueue Scripts and Styles with timestamp
<?php
function my_load_scripts($hook) {
// create version codes
$my_js_ver = date("ymd-Gis", filemtime( get_stylesheet_directory() .'/js/myscript.js' ));
$my_css_ver = date("ymd-Gis", filemtime( get_stylesheet_directory() . '/style.css' ));
wp_enqueue_script( 'my-script-name', get_stylesheet_directory() . '/js/myscript.js', array(), $my_js_ver );
@ssuess
ssuess / wordpress-import-update.php
Last active August 15, 2023 21:25 — forked from balbuf/wordpress-import-update.php
Force the WordPress importer to update existing posts instead of skipping them
<?php
/**
* When using the WordPress Importer, update existing
* posts instead of skipping them. Updates content according
* to the import file even if the existing post was updated
* more recently.
*
* To use, drop this file into your /mu-plugins/ folder or
* copy this code into your functions.php file.
@tcoupin
tcoupin / Setup Pgadmin4 docker.md
Last active April 9, 2024 18:01
Setup Pgadmin4 docker

Just run:

curl https://gist.githubusercontent.com/tcoupin/af82bbbf5de516d186c1f2170ae5d0c4/raw/setup.sh | bash

Notes:

  • on close, the container is not close.
  • default email : admin@admin.admin, default password admin
  • a volume named "pgadmin" is create to store config
@mjangda
mjangda / ngrok-and-jetpack.md
Last active February 7, 2023 07:57
How to connect ngrok to your local WordPress environment (props @DanReyLop)

How to develop with Jetpack locally with ngrok

To connect Jetpack in your local installation, you'll need a way for WP.com servers to reach your server. That can be done in a number of different ways:

  • You can open your router's ports and use your public IP
  • You can use some kind of Dynamic DNS provider.

But these options fall short of ngrok, which is a "localhost tunnel". It basically allows the Internet to hit a local port on your machine without worrying about ports or IPs.

As long as ngrok is running, Jetpack / WP.com will be able to communicate with your local site. This will allow remote modules like Site Search and Manage to work.

@d1i1m1o1n
d1i1m1o1n / text
Created October 6, 2016 12:16
How to disable auto-save in phpstorm
How to disable auto-save:
Go to File > Settings (Ctrl+Alt+S).
Go to Appearance & Behavior > System Settings.
Make sure the two are unchecked:
Save files on frame deactivation
Save files automatically if application is idle for x sec.
Go to Editor > General > Editor Tabs
Put a checkmark on "Mark modified files with asterisk"
(Optional but recommended) Under "Tab Closing Policy", select "Close non-modified files first". You may also want to increase the number of allowed tabs.
Click Apply > OK.
@nrollr
nrollr / ApacheHTTPSConfig.md
Last active March 11, 2024 13:32
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using Terminal.app: sudo mkdir /etc/apache2/ssl
Next, generate two host keys:

@ethicka
ethicka / localhost-ssl.md
Last active April 12, 2024 12:26 — forked from jonathantneal/README.md
Local virtualhost SSL websites on Mac OS Sierra

Local virtualhost SSL websites on Mac OS Sierra

These instructions will guide you through the process of setting up a wildcard SSL for your local virtualhosts for offline development. Most importantly, this configuration will give you the happy, green lock in Chrome.

These instructions have only been tested on Mac OS Sierra using the pre-installed Apache and PHP versions. These instructions also assume you have virtualhosts set up locally already.


Configuring SSL

@wosephjeber
wosephjeber / ngrok-installation.md
Last active March 22, 2024 15:55
Installing ngrok on Mac

Installing ngrok on OSX

For Homebrew v2.6.x and below:

brew cask install ngrok

For Homebrew v2.7.x and above:

@Iman
Iman / clean.sh
Last active April 15, 2024 16:50
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs