Skip to content

Instantly share code, notes, and snippets.

View justinph's full-sized avatar

Justin Heideman justinph

View GitHub Profile
@justinph
justinph / index.php
Last active August 29, 2015 13:57
Very simple script to allow for cycling through of images in a directory. Useful for viewing a bunch of screenshots or mockups in a folder somewhere on a LAMP host.
<?php
// get all images in dir
$imgs = glob("*.{jpg,png,gif,jpeg,svg,mng,PNG,JPG,JPEG,GIF,SVG,MNG}", GLOB_BRACE);
sort($imgs);
if (count($imgs) > 0){
$totalImgs = count($imgs);
}
@justinph
justinph / center mn counties.txt
Last active August 29, 2015 14:06
Center of all MN Counties
-92.722817065150579,44.40976199131358
-92.230230530518796,44.284276871133507
-92.09015218749218,43.674021935441147
-92.460295466512846,47.58592374749955
-92.40167525467632,44.00370542918499
-96.468091179952921,46.356592270770768
-92.74187022646349,46.120383787038293
-93.293584007629505,45.945007570630324
-96.095346898032901,47.871808918108371
-96.036691444877206,48.066466411321635
@justinph
justinph / .eslintrc
Created September 29, 2015 19:11
Updated eslint config to work with 1.0+, deals with `space-after-function-name` depreciation
{
"env": {
"browser": true,
"amd": true
},
"globals": {
"magnum": true,
"define": true,
"require": true,
"Modernizr": true,
@justinph
justinph / responsive-embeds.php
Last active December 18, 2015 22:08
Theme-based embed.ly oEmbed support for Wordpress multisite installations.
// We use embed.ly to help with oembeds that aren't very clean
// Define our API KEY
define('EMBEDLY_KEY','YOUR_KEY_HERE');
// remove default polldaddy provider because its broken
// this can be removed when WP removes support for polldaddy
// see http://core.trac.wordpress.org/ticket/24395
wp_oembed_remove_provider( '#https?://(.+\.)?polldaddy\.com/.*#i' );
@justinph
justinph / fusiontables_google_map.php
Created June 24, 2013 17:36
Adds a fake/faux oEmbed provider for google fusion tables.
<?php
/* Faux Google Maps Fusiontables oEmbed
* Embed google maps in a nicer iframe without using their provided embed code
* @usage Paste a Google Maps link in your post and it will be replaced with an iframe when published
*/
/*
* Example embed URL:
* https://www.google.com/fusiontables/embedviz?viz=MAP&q=select+col6+from+1is6E5G4IwxTxG43X8F-v1N_OOSy_lJo_JhrI01U&h=false&lat=45.302540427209586&lng=-93.85018772275396&z=7&t=1&l=col6&y=6&tmplt=8
*/
@justinph
justinph / embedly_patterns.def
Created June 24, 2013 17:30
Embed.ly patterns for wordpress.
#http://.*twitch\.tv/.*#i
#http://.*justin\.tv/.*/b/.*#i
#http://.*justin\.tv/.*/w/.*#i
#http://.*twitch\.tv/.*#i
#http://.*twitch\.tv/.*/b/.*#i
#http://www\.ustream\.tv/recorded/.*#i
#http://www\.ustream\.tv/channel/.*#i
#http://www\.ustream\.tv/.*#i
#http://ustre\.am/.*#i
#http://qik\.com/video/.*#i
@justinph
justinph / documentcloud.php
Created June 24, 2013 17:37
Add a fake/faux oEmbed provider for DocumentCloud. Also adds a shortcode.
<?php
/* Faux DocumentCloud oEmbed
* Embed documentcloud inline without using their provided embed code because it sucks
* @usage Paste a Documentcloud link in your post and it will be replaced with an the proper code when published
*/
/*
* Example embed URL:
* http://www.documentcloud.org/documents/693854-macalester-collge-letter-to-students-about-wells.html
*/
@justinph
justinph / ie8_compat.less
Created October 31, 2013 19:16
MPR News base.less
// for IE8, we bring in these
@import "medium";
@import "large";
body{
min-width: 980px;
}
requirejs: {
compile: {
options: {
baseUrl: "public_html/js",
dir: "public_html/js-built",
mainConfigFile: "public_html/js/init.js",
optimize: "uglify2",
skipDirOptimize: true,
preserveLicenseComments: false,
separateCSS: true,
@justinph
justinph / .htaccess
Created January 22, 2014 19:36
mprnews mod_rewrite example
RewriteEngine On
# Allows our static assets to be versioned
# javascript (js) is versioned seperately because it has a more complicated build process
# also create a shortcut path /a/ for static assets because it uses less characters
RewriteRule ^js-built/([0-9]+)/(.*)$ /js-built/$2 [L]
RewriteRule ^a/([0-9]+)/(.*)$ /assets/$2 [L]
RewriteRule ^assets/([0-9]+)/(.*)$ /assets/$2 [L]