Skip to content

Instantly share code, notes, and snippets.

@eddiemoya
eddiemoya / fpm.sh
Last active December 16, 2015 15:29
Simple bash script that allows you to stop, start to restart PMP-FPM.
#!/bin/bash
command=$1
pidfile='/usr/local/var/run/php-fpm.pid'
function killfpm {
if [ -f $pidfile ]; then
pid=$(cat $pidfile);
sudo kill $pid
echo "PHP-FPM is Dead: PID:$pid"
<?php /** NOTE: This is the example from the Codex, which think is BAD. **/
// Create a new filtering function that will add our where clause to the query
function filter_where( $where = '' ) {
// posts in the last 30 days (hardcoded)
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
return $where;
}
//Requires immediate additiona and removal of the filter for intended use.
@eddiemoya
eddiemoya / wp-query-since.php
Last active August 5, 2022 15:59
Allows WP_Query to use a 'since' argument to query for relative date queries using `strtotime()`
<?php
/**
* Allows WP_Query to use a 'since' argument to query for
* relative date queries.
*
* Usage: Query posts from last 30 days
* $query = new WP_Query('since' => '-30 days');
*
* @uses strtotime()
* @author Eddie Moya
@eddiemoya
eddiemoya / git-unrm.sh
Last active August 5, 2022 15:59
Restores file that was deleted in a previous commit based on its last known state before it was removed.
### Git Unremove ##
# Adds an alias called "unrm" to retrieve a pile or path deleted at any point in the repositories history.
# Usage:
# git unrm [path]
# git unrm path/to/file
git config --global alias.unrm '!COMMIT=$(git log -1 --pretty=%h -- "$1"); git checkout $COMMIT^ -- "$1"; echo "File: $1, was restored from commit $COMMIT"; git show -s $COMMIT'
#!/bin/bash
SYNC_BIN_PATH=`dirname $(readlink -f $0)`
TMP_PATH="$SYNC_BIN_PATH/tmp"
REPO_PLUGINS="$SYNC_BIN_PATH/uxwpress/plugins/*"
NEW_REPO_PLUGINS="$SYNC_BIN_PATH/plugins"
for i in $REPO_PLUGINS
do
CURRENT_PLUGIN_NAME=`basename "$i"`
<!-- List Style Image Menu Widget -->
<!--
For list style widget add class 'image-list-style' to div with class 'subnav-items'
-->
<article class="widget content-container span12 communities_menu_widget menu-garden-solutions-center-top-garden-categories">
<header class="content-header">
<h3>Our Top Garden Categories</h3>
<h4>Check out what's popular in the community</h4>
</header>
<section class="content-body clearfix">
<!-- Grid Style Image Menu Widget -->
<!--
For GRID style widget add class 'image-grid-style' to div with class 'subnav-items'
-->
<article class="widget content-container span12 communities_menu_widget menu-garden-solutions-center-knowledge-in-bloom">
<header class="content-header">
<h3>Knowledge in Bloom</h3>
<h4>Helpful links to blossom from</h4>
</header>
##
# Creates an alias called "git hist" that outputs a nicely formatted git log.
# Usage is just like "git log"
# Examples:
# git hist
# git hist -5
# git hist <branch_name>
# git hist <tag_name> -10
##
git config --global alias.hist "log --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(red)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --graph --date=short"
@eddiemoya
eddiemoya / post-video.html
Last active December 15, 2015 02:39
Markup for single post-format video pages.
<section class="span12">
<section class="span8">
<!-- VIDEO ARTICLE -->
<article class="content-container post span12">
<section class="content-body clearfix">
<div class="content-video">
<!-- YOU HAVE TO INCLUDE PARAMETER 'wmode=opaque' OR VIDEO OVERLAPS SITE -->
@eddiemoya
eddiemoya / git-fetch-tags.sh
Last active December 14, 2015 12:29
One Line: git fetch --tags
# Passing the --tags argument makes fetch retreive tags explicitly.
git fetch --tags