Finds a value in a CSV file based on its column and row header
mixed intersect ( string $filename , mixed $column , mixed $row )
// Start | |
mongod --dbpath C:\Programs\MongoDB\Data | |
// Dump & Restore | |
mongodump --host HOST_NAME --db DATABASE_NAME --username USERNAME --password "PASSWORD" --out BACKUP_PATH | |
mongorestore --host HOST_NAME --db DATABASE_NAME RESTORE_PATH |
# Redirect 503 / |
# Quick Convert | |
ffmpeg -i input.mkv -c copy output.mp4 | |
# To "Standard" MP4 | |
ffmpeg -i input.mkv -c:v h264 -c:a aac output.mp4 |
// v-on:click handlers can only take one expression, so you can't close | |
// a modal and update vars in one. This function updates vars on the | |
// current Vue object, closes a modal (based on CSS selector) and, | |
// optionally, opens another modal after a delay to all appear smooth | |
modalNav: function(vars, close, open) { | |
for (var attr in vars) { this[attr] = vars[attr]; } | |
document.querySelectorAll(close)[0].classList.remove('active') | |
if (typeof open !== 'undefined') { | |
window.setTimeout(function () { | |
document.querySelectorAll(open)[0].classList.add('active') |
<?php | |
function delete($path) { | |
$files = scandir($path); | |
foreach ($files as $file) { | |
if (!in_array($file, ['.', '..'])) { | |
$full = $path . DIRECTORY_SEPARATOR . $file; | |
if (is_file($full)) unlink($full); | |
if (is_dir($full)) delete($full); | |
} |
# Basic | |
rsync -avz --delete ./source/ ./destination | |
# Windows deployment script with SSH fix | |
rsync -avz --delete --progress --exclude '.git' --chmod=755 -e 'C:\Programs\rsync\ssh.exe' ./path/to/source user@host:/path/to/destination |
<?php | |
/** | |
* Allows you to specify a template for a post type while storing the | |
* template file outside of a theme. | |
* | |
* @param string $file Full path to template file | |
* @param string $post_type Post Type to use template | |
*/ | |
function set_single_template( $file, $post_type ) { |
<?php | |
/** | |
* Changes the taxonomy checkboxes into radios so only one can be selected | |
* | |
* @param string|array $taxonomies Taxonomy(s) to be affected | |
* @param string|array $post_types Post Type(s) to be affected | |
*/ | |
function taxonomy_radios( $taxonomies, $post_types ) { | |
// Ensure params are arrays |
<?php | |
/** | |
* Adds filter for taxonomies to posts table | |
* | |
* Adapted from: | |
* @see http://wordpress.org/support/topic/custom-taxonomy-filter-not-working-in-admin-editphp-31b2?replies=8#post-2400615 | |
* @see https://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-filter-to-admin-list-for-a-custom-post-type/3215#3215 | |
* | |
* @param array $taxonomy Filter to be added |