Skip to content

Instantly share code, notes, and snippets.

Marty Penner martypenner

Block or report user

Report or block martypenner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View adapters.application.js
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
martypenner /
Last active Aug 29, 2015
Generate CSR w/ SHA256
openssl req -nodes -sha256 -newkey rsa:2048 -keyout -out
martypenner / functions.php
Created Oct 23, 2014
Various common WordPress editor styles
View functions.php
* @param array $config
* @return array
function tiny_mce_before_init(array $config)
$styleFormats = [
// Utility classes like "float right"
martypenner / app.yaml
Created Oct 23, 2014
GCloud app.yaml w/ good list of static mime types
View app.yaml
application: <<YOUR_APP_NAME>>
version: 1
runtime: php
api_version: 1
default_expiration: "30d"
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
martypenner / drupal-bootstrap.php
Created Apr 1, 2014
Drupal 7 Bootstrapper for stand-alone scripts. Useful if you want to run custom logic, but still have access to core Drupal function, like `node_load`, `node_delete`, etc.
View drupal-bootstrap.php
// CHANGE this to whatever your root path is
$relativePathToDrupalRoot = './';
// Bootstrap Drupal
define('DRUPAL_ROOT', realpath(getcwd().'/'.$relativePathToDrupalRoot));
require_once DRUPAL_ROOT.'/includes/';
martypenner / BugSense.html
Last active Aug 29, 2015
An alternate BugSense inclusion snippet I prefer over theirs because it allows async loading. Put this in the <head> of your document (yes, I know that's bad practice, but BugSense is there to catch all errors, so it has to be up there). Note that the async part means it might not be loaded before other scripts initialize and throw errors, but a…
View BugSense.html
var bugsense;
function initErrorReporting () {
if (window.location.hostname !== 'localhost') {
// Check if bugsense has loaded so we don't throw an accidental error
bugsense = undefined !== window.Bugsense ? new window.Bugsense({apiKey:'PROD_API_KEY'}) : {};
<script async src="//" onload="initErrorReporting()"></script>
martypenner / replace-abs-paths.sql
Last active Dec 29, 2015
Wordpress db - absolute path replacement queries. Should be imported into Sequel Pro to get tab completion for placeholders.
View replace-abs-paths.sql
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, '${0:dev_url}', '${1:prod_url}')
WHERE meta_value LIKE '%$0%';
UPDATE wp_posts
SET post_content = REPLACE(post_content, '$0/', '/')
WHERE post_content LIKE '%$0%';
UPDATE wp_posts
SET guid = REPLACE(guid, '$0', '$1')
martypenner / .htaccess
Last active Dec 27, 2015
.htaccess rewrites
View .htaccess
# Ensure all non-dev, non-staging URLs redirect to
RewriteCond %{HTTP_HOST} !^(.+)\.dev$ [NC]
RewriteCond %{HTTP_HOST} !^.*\.staging\.com$ [NC]
RewriteCond %{HTTP_HOST} !^example\.ca$ [NC]
RewriteRule ^(.*)$1 [R=301,QSA,L]
# Send www.* to the non-prefixed domain
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
martypenner / _atoms.scss
Last active Dec 26, 2015
Smoother @font-face embedding in IE6-8
View _atoms.scss
* Smoother @font-face embedding in IE6-8. Extend this class on anything that needs smooth fonts.
* NB: the filter appears to place an overflow: hidden-style block around the elements being smoothed,
* so do not apply these rules directly to elements that need to scroll, or which contain absolutely
* positioned elements that appear outside the boundaries of the element itself.
.smooth-fonts {
letter-spacing: 0;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwO
martypenner / coming-soon.html
Last active Nov 19, 2016
"Coming Soon" page (self-contained)
View coming-soon.html
<!doctype html>
<html class="no-js">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Coming Soon</title>
<meta name="viewport" content="width=device-width">
You can’t perform that action at this time.