Skip to content

Instantly share code, notes, and snippets.

Avatar

Gabe Shackle hereswhatidid

View GitHub Profile
@hereswhatidid
hereswhatidid / archive-of-single-commit.git
Created Feb 7, 2014
Create an archive of files modified within the given commit.
View archive-of-single-commit.git
git archive -o update.zip HEAD $(git diff --name-only COMMITIDHERE^)
@hereswhatidid
hereswhatidid / get-wordpress.bat
Created Feb 15, 2014
Windows batch file for getting the latest WordPress core files
View get-wordpress.bat
wget64 http://wordpress.org/latest.tar.gz
7z e latest.tar.gz & 7z x latest.tar
robocopy wordpress ./ /MOVE /E
del latest.tar
del latest.tar.gz
ren wp-config-sample.php wp-config.php
@hereswhatidid
hereswhatidid / localize-bootstrap.less
Created Feb 16, 2014
Localize Bootstrap to a container element (pre 3.0)
View localize-bootstrap.less
.bootstrap-wrapper {
@import url( '../vendor/bootstrap/bootstrap.less' );
}
@hereswhatidid
hereswhatidid / query-user-firstname.php
Last active Aug 29, 2015
WP_User_Query meta parameters for first name
View query-user-firstname.php
<?php
$args = array(
'role' => 'Administrator',
'meta_query' => array(
array(
'key' => 'first_name',
'value' => '',
'compare' => '!='
),
),
View geo-on-save.php
<?php
//Auctions should be geocoded on save
function geocode_auction($post_id){
$auction_slug = 'auctions';
$_POST += array("{$auction_slug}_edit_nonce" => '');
if ( $auction_slug == $_POST['post_type'] && current_user_can( 'edit_post', $post_id )) {
$address = get_post_meta(get_the_ID(), 'Location', true);
@hereswhatidid
hereswhatidid / archive-dev.sh
Created May 5, 2014
Creates an archive of the files that are different between the master and development branches using Sourcetree on the Mac.
View archive-dev.sh
#!/bin/sh
args=("$@")
git archive -o deploy/deploy-devcompare.zip HEAD $(git diff-tree --no-commit-id --name-only -r master..development)
@hereswhatidid
hereswhatidid / bindOnce.js
Created Mar 11, 2015
Directive to remove watchers from an element within AngularJS
View bindOnce.js
angular
.module( 'yourAppName' )
.directive( 'bindOnce', BindOnce );
function BindOnce() {
return {
scope: true,
link: function( $scope ) {
setTimeout(function() {
$scope.$destroy();
@hereswhatidid
hereswhatidid / dnn_overrides.less
Created Apr 3, 2015
LESS code for cleaning up link chooser dialog in DNN.
View dnn_overrides.less
.ui-dialog {
* {
box-sizing: content-box;
}
.ui-dialog-titlebar {
border-bottom: none;
}
.page {
width: 100% !important;
}
@hereswhatidid
hereswhatidid / disable-long-comments.php
Created Apr 27, 2015
WordPress 4.2 comment fix - this will disable any comment over a certain lenght that could theoretically trigger the XSS vulnerability.
View disable-long-comments.php
<?php
add_filter( 'pre_comment_content', function( $content ) {
if ( strlen( $content ) > 64000 )
wp_die( 'Invalid comment.' );
return $content;
} );
@hereswhatidid
hereswhatidid / acf-wysiwyg-body-class.php
Created Aug 12, 2015
Adds a custom class to a specific WYSIWYG editor within Advanced Custom Fields.
View acf-wysiwyg-body-class.php
<?php
function my_acf_admin_footer() {
?>
<script>
( function( $) {
acf.add_filter( 'wysiwyg_tinymce_settings', function( mceInit, id ) {
if ( id === 'special-wysiwyg-field' ) {
mceInit.body_class += ' magical-field-class';
}
return mceInit;
You can’t perform that action at this time.