Skip to content

Instantly share code, notes, and snippets.

@cristovaov
cristovaov / gist:8691070
Created January 29, 2014 16:00
loop-attachment.php
<?php
/**
* The loop that displays an attachment
*
*/
?>
<?php if ( ! empty( $post->post_parent ) ) : ?>
<p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php echo esc_attr( sprintf( __( 'Return to %s', 'twentyten' ), strip_tags( get_the_title( $post->post_parent ) ) ) ); ?>" rel="gallery"><?php
/* translators: %s - title of parent post */
@cristovaov
cristovaov / map-vm.cmd
Last active December 2, 2015 21:33
Lazy way to map a Vagrant virtual machine...
@ECHO off
net use z: "%1" /user:vagrant vagrant
@cristovaov
cristovaov / WP Plugins Directory search for Firefox
Last active December 23, 2015 01:59
WP Plugins Directory search for Firefox--adds WP Plugins in your search bar--- see logbook for info/instructions http://wp.me/pKmdR-nX
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>WordPress Plugins Directory</os:ShortName>
<os:Description>WordPress Plugins Directory</os:Description>
<os:InputEncoding>UTF-8</os:InputEncoding>
<os:Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC3ElEQVQ4jXVTz0sbaxT9Vl30D+if8AoPusmmf1E3gWyyziIyMvcbS2RMnDBmxoAbwYBxJpmagGhDggpRW2h9T32JYWaycSA/TAbKRON3utFCte/AhQv33AuHew5jzyBJ0lvOeYaITjnnc875/LHPSJL09jn/N8iynFQUZVQulxu9Xu+L53ljz/PGvV7vS7lcbiiKMpJlOfliMZ1OvyKimqZpV0EQdA4PD1EsFsE5hyRJMAwD7XYbg8HgP03Troiolk6nX/06QERqoVD4Oh6Pp4ZhQJblP9bu7i4A/CgUCl855xnGGGOc83eKooyiKLqo1+twHAfLy8uoVCpwHAeO42BrawuKouDu7g4AEEWR/yjnb0ZEqm3b+0/DTqeDbDaLSqUCIQQAoFQqIZPJwPM9AMDk9ha2be9zzjOMc37p+/5pvV4HAPi+j5WVFaiqim63CwCoVqtQVRXl8g4A4Pu37/B9/5SI/mFENJvP50Nd1zEcDnF/fw/TNLG6uoparQYhBK6vr/GRcxTXiwCAnZ0dRFE04pzfMiKaRVE0Wl9fx9HREYQQaLVayOVyaLfbEEJgPp9D0zSUSiUMBgOsra1hNpuNiChkRNTxff/Utm1sbm7i4eEBNzc3+Mg5Li4u0Gg0IISAZ
@cristovaov
cristovaov / Simple Feed Disabler WP
Last active December 23, 2015 01:59
Simple Feed disabler & redirect for WordPress -- snippet to add to your function file ---- see logbook for info/instructions http://wp.me/pKmdR-p8
/* disable and redirect feed links snippet
by Cristovao Verstraeten - apleasantview.com 2013*/
function simple_nofeed() {
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
if ( is_feed() )
{
status_header( '404' );
@cristovaov
cristovaov / simple-sticky-footer_css
Last active December 23, 2015 04:08
Simple bootstrap based sticky footer --just what it says ---see logbook for info/instructions http://wp.me/pKmdR-oo
@cristovaov
cristovaov / file-name-sanvertwo.php
Created November 27, 2013 11:27
trying to apply patch 22363.8 as a plugin to not mess with wp core files -helps me as well to understand the remove_ process ----do not use as it is not yet functioning -- getting 'fatal error: cannot redeclare...'
<?php
/*
Plugin Name: file name sanitizer
Description: Removes accents at file upload from WP Trac. Patch at http://core.trac.wordpress.org/attachment/ticket/22363/22363.8.patch
Version: 26 10 2013
*/
remove_filter('sanitize_file_name', $filename, $filename_raw);
/**
@cristovaov
cristovaov / search-n-strip.py
Created February 3, 2016 15:05
Search and stripping in a file. My first Python script y'all! I needed this to strip a SQL string,
import os
import sys
def main():
print "\n"
fn = raw_input("Enter name of file: ")
print "Opening file: %s\n" % fn
if not os.path.exists(fn):
print("File does not exist!\n")
@cristovaov
cristovaov / generate_release_log.sh
Created July 9, 2016 15:07
Generates a log file from latest tag and (n) of commits passed
#!/bin/bash -
#title :generate_release_log.sh
#description :generates a log file from latest tag and (n) of commits passed
#author :Cristovao Verstraeten
#date :20160709
#version :20160709
#usage :./generate_release_log.sh
#notes :
#bash_version :4.3.39(3)-release
#============================================================================
@cristovaov
cristovaov / activate
Last active August 12, 2016 22:21
Crude script to activate a Python virtual environment in Git Bash. Probably works w/ MSYS2, not sure on Cygwin -> needs usecases.
# Usage like activating venv on Linux: source /path/to/env/Scripts/activate
# Use 'deactivate_venv' on CL or pass argument '--deactivate' on the source command to deactivate env.
deactivate_venv() {
if [[ -z ${_OLD_VIRTUAL_PATH} ]]; then
printf "No virtual environment found!\n"
else
export PATH=$_OLD_VIRTUAL_PATH
export PS1=$_OLD_VIRTUAL_PS1
unset _OLD_VIRTUAL_PATH