Skip to content

Instantly share code, notes, and snippets.

View bvandreunen's full-sized avatar

Bastiaan van Dreunen bvandreunen

View GitHub Profile
@bvandreunen
bvandreunen / create-project
Last active March 24, 2019 20:40
Create new vhost/project in Homestead
#!/bin/bash
CONFIGFILE=~/Homestead/Homestead.yaml
HOSTSFILE=/etc/hosts
VAGRANTID=1fbc8f8
if ! [ $(id -u) = 0 ]; then
echo "Please run script with sudo to allow for hosts file changes." >&2
exit 1
fi
@bvandreunen
bvandreunen / wget-download-website.
Created December 21, 2015 10:31
Download entire website with wget
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains mydomain.com \
http://www.mydomain.com
@bvandreunen
bvandreunen / template-html.conf
Last active August 29, 2015 14:22
Generate vhosts
# ************************************
# Vhost template
# ************************************
<VirtualHost *:80>
ServerName %template%
## Vhost docroot
DocumentRoot "/var/www/%template%/app/html"
@bvandreunen
bvandreunen / gist:3488705a1a04b95db143
Last active August 29, 2015 14:21
Replace double quotes with ticks in SQL dump
sed -i '.bak' 's/"/`/g' dump.sql
@bvandreunen
bvandreunen / gist:11156130
Created April 21, 2014 20:51
Move Yoast WordPress SEO Box down
<?php
add_filter( 'wpseo_metabox_prio', function() {
return 'low';
});
#Explicit mappings match any token sequence on the LHS of "=>"
#and replace with all alternatives on the RHS. These types of mappings
#ignore the expand parameter in the schema.
#Examples:
i-pod, i pod => ipod,
sea biscuit, sea biscit => seabiscuit
#Equivalent synonyms may be separated with commas and give
#no explicit mapping. In this case the mapping behavior will
@bvandreunen
bvandreunen / reset.scss
Created January 27, 2014 22:12
Eric Meyer's reset.css in SCSS. Based on Sass version by @trey, originally by @postpostmodern
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain) */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
@bvandreunen
bvandreunen / gist:7970575
Created December 15, 2013 08:59
In WordPress, takes a url from a custom field and turns it into a thumbnail ID. Found here: http://pastie.org/2386814
<?php
/*
Plugin Name: Update thumbnails
Plugin URI: http://pmg.co
Description: Takes a url from a custom field and turns it into a thumbnail ID
Version: .01
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
*/
@bvandreunen
bvandreunen / user-avatar.patch
Created September 12, 2012 10:09
User avatar upload dir patch
--- /Users/superinteractive/Downloads/user-avatar/user-avatar.php 2012-07-17 17:46:44.000000000 +0200
+++ ./www/app/www/content/plugins/user-avatar/user-avatar.php 2012-09-12 12:23:34.000000000 +0200
@@ -591,9 +591,10 @@
if( $avatar_img = user_avatar_avatar_exists( $item_id ) ):
- $avatar_src = get_site_url()."/wp-content/uploads/avatars/".$item_id."/".$avatar_img;
+ $upload_dir = wp_upload_dir();
+ $avatar_src = $upload_dir['baseurl']."/avatars/".$item_id."/".$avatar_img;
if(function_exists('is_subdomain_install') && !is_subdomain_install())
@bvandreunen
bvandreunen / wp.config.php
Created July 29, 2012 23:39
wp.config.php
<?php include_once("${_SERVER['DOCUMENT_ROOT']}/wp-config.php"); ?>