This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pull a production WP database to an existing local site | |
# uses current directory as theme path and ssh alias | |
pullprod() { | |
START=$(date +%s) | |
# get current directory name, used for database and URL | |
# TODO: use echo get_template_directory() and get characters from right to first / | |
current=${PWD##*/} | |
cd ~/Sites/$current | |
# make a backup of the current local database | |
wp db export _db.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# push a local WP database to an existing staging site | |
# uses current directory as theme path and ssh alias | |
pushstage() { | |
START=$(date +%s) | |
# make a backup of the current local database | |
# get current directory name, used for database and URL | |
current=${PWD##*/} | |
cd ~/Sites/$current || return | |
# rsync the local database to staging site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for initial site deployment to staging server, excludes dev tools and build files | |
# uses current directory as theme path and ssh alias | |
# 3 user inputs: dbname, dbuser, dbpass | |
firstdeploy() { | |
current=${PWD##*/} | |
cd ~/Sites/$current || return | |
echo "Database name:" | |
read dbname | |
echo "Database user:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Thanks to http://steindom.com/articles/shortest-php-code-convert-csv-associative-array */ | |
ini_set('auto_detect_line_endings', TRUE); | |
$rows = array_map('str_getcsv', file('myfile.csv')); | |
$header = array_shift($rows); | |
$csv = array(); | |
foreach ($rows as $row) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get from a remote file to STDOUT: | |
wget -qO- https://www.membrane-australasia.org/gallery/imstec-2016-adelaide-part-3/ | | |
grep -Eoi '<a [^>]+>' | grep -Eo 'href="[^\"]+"' | | |
grep -Eo '(http|https)://[a-zA-Z0-9./?=_-]*' | | |
uniq | |
get from a remote file to xargs and download each URL | |
wget -qO- https://www.membrane-australasia.org/gallery/imstec-2016-adelaide-part-1/ | grep -Eoi '<a [^>]+>' | grep -Eo 'href="[^\"]+"' | grep -Eo '(http|https)://[a-zA-Z0-9./?=_-]*' | uniq | xargs -n 1 -P 24 curl -LO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.flex-row{ | |
display: flex; | |
// shorthand for flex-direction & flex-wrap | |
flex-flow: row wrap; | |
justify-content: space-between; | |
align-items: flex-start; | |
@media #{$small-only} { | |
display: block; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ginput_container { | |
overflow: hidden; | |
margin: 5px 0 0; | |
padding: 1rem; | |
background-color: #dcdcdc; | |
border-radius: 4px; | |
ul.gfield_checkbox li input{ | |
&[type="checkbox"]:not(:checked), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This script uses rsstail to retrieve latests entries from Reddit Popular rss feed | |
# and process them through awk. Each update shows a timestamp separator. | |
# | |
# It will work with most RSS feeds out there. | |
# | |
if [ $# -eq 1 ]; then | |
subreddit="r/$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sort by date field showing events after today | |
function dmc_training_cpt_pre_get_posts( $query ) { | |
if ( is_admin() || ! $query->is_main_query() ) { return; | |
} | |
if ( is_post_type_archive( 'dmc-offer' ) ) | |
{ | |
$date_now = date( 'Y-m-d H:i' ); | |
$query->set( 'posts_per_page', -1 ); |