Skip to content

Instantly share code, notes, and snippets.

View 50l3r's full-sized avatar
🏠
Working from home

50l3r 50l3r

🏠
Working from home
View GitHub Profile
@micah1701
micah1701 / dateFormat.js
Last active September 16, 2024 13:24
Replicate PHP's native date() formatting in JavaScript for many common format types
/**
* Return a formated string from a date Object mimicking PHP's date() functionality
*
* format string "Y-m-d H:i:s" or similar PHP-style date format string
* date mixed Date Object, Datestring, or milliseconds
*
*/
function dateFormat(format,date){
if(!date || date === "")
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@felipeelia
felipeelia / woocommerce-orderby-featured-products.php
Last active August 3, 2023 13:47
Bring featured products first in a WP_Query
@pirate
pirate / docker-compose-backup.sh
Last active December 6, 2024 09:54
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail