Skip to content

Instantly share code, notes, and snippets.

View DrewAPicture's full-sized avatar

Drew Jaynes DrewAPicture

View GitHub Profile
mysql -u wp -p wp -e "drop database wptests; create database wptests;"
@abernardobr
abernardobr / Installing Graphics Magic
Created August 14, 2015 13:50
How to install Graphics Magick
## On Windows:
``http://www.graphicsmagick.org/INSTALL-windows.html``
## On the Mac:
``brew install graphicsmagick``
## On the Joyent box:
```
@gregrickaby
gregrickaby / infinite-scroll-masonry-imagesloaded.php
Last active June 14, 2023 13:01
Infinite Scroll + Masonry + ImagesLoaded
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@reinink
reinink / bootstrap.php
Created February 20, 2014 12:16
Using illuminate/container outside of Laravel
<?php
// Vendor includes
include $config->base_path . '/libraries/Vendor/autoload.php';
// Include configuration file
$config = include('../config.php');
// Create IoC container
$ioc = new \Illuminate\Container\Container;
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active May 24, 2024 01:23
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@Otto42
Otto42 / time-shortcode.php
Created September 13, 2013 15:50
Time shortcode used for make p2's
<?php
/**
* Plugin: Time Shortcode
* Author: Otto
*
* Usage: [time]any-valid-time-string-here[/time]
* Will attempt to parse the time string and create a format that shows it in the viewers local time zone
* Note that times should be complete with year, month, day, and hour and minute.. something strtotime can parse meaningfully
* Conversion happens via Javascript and will depend on the users browser.
**/
@tammyhart
tammyhart / responsive-iframes.js
Last active August 19, 2018 11:10
Make iframes responsive by calculating the correct aspect ratio and filling to the width of the container as it flexes.
// iframes
var $iframes = $( document.querySelectorAll( '.videos iframe' ) );
function iframeSizing() {
var $this = $( this ),
width = $this.width(),
height = $this.height(),
containerWidth = $this.parent().width(),
heightRatio = height / width,
newHeight = heightRatio * containerWidth;
@adamjimenez
adamjimenez / gist:5917897
Created July 3, 2013 13:36
Generate thumbnails from video files using HTML5's video tag and canvas
<?php
//where you want your thumbnails to go
$thumbs_dir = 'uploads/thumbs/';
//this should be an array of video paths
$videos = array();
if( $_POST["name"] ){
// Grab the MIME type and the data with a regex for convenience
if (!preg_match('/data:([^;]*);base64,(.*)/', $_POST['data'], $matches)) {
@boonebgorges
boonebgorges / gist:5510970
Created May 3, 2013 16:42
A recursive sorta-version of wp_parse_args()
<?php
/**
* Recursive argument parsing
*
* This acts like a multi-dimensional version of wp_parse_args() (minus
* the querystring parsing - you must pass arrays).
*
* Values from $a override those from $b; keys in $b that don't exist
* in $a are passed through.
@lgedeon
lgedeon / gist:5414093
Last active December 16, 2015 09:38
Generic field sanitization class for WP core.
<?php
/**
* Provide functionality to register new Archive Elements
*/
/**
* Proposed generic field class to be used by the Settings API, Widgets,