Skip to content

Instantly share code, notes, and snippets.

@mattbeck
mattbeck / drupal-t-keybinding.json
Created Apr 5, 2019
Drupal t() keybinding for Sublime
View drupal-t-keybinding.json
[
{
"keys": ["ctrl+super+t"],
"command": "insert_snippet",
"args": {
"contents": "<?php echo t('$SELECTION');?>"
},
"context":
[
{ "key": "selection_empty", "operator": "equal", "operand": false }
View gist:7a4c95f6a7c78e619dd7
<html>
<head>
<!-- Written by Matt Beck. matt@couldbestudios.com -->
<title>Roll Fate Dice</title>
<style>
body{
background: #e0dfd0;
text-align: center;
font-family: helvetica;
max-width: 100%;
@mattbeck
mattbeck / gist:54a61278fdbf4873762c
Created Sep 21, 2014
force relative urls in content
View gist:54a61278fdbf4873762c
add_filter('the_content', 'my_content_filter');
function my_content_filter($content){
$content = str_ireplace('http://url-to-strip.com','',$content);
return $content;
}
@mattbeck
mattbeck / gist:1604156ada969dea9947
Last active Aug 29, 2015
Markdown Handling index.php
View gist:1604156ada969dea9947
<?php
$query_string = $_SERVER['QUERY_STRING'];
$uri = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_STRING);
$uri = str_ireplace('?'.$query_string, "", $uri);
$uri = rtrim($uri, '/'); // strip trailing slashes
if($uri !== ""){
// Check if matching markdown file exists
$mdfilename = $uri.'.md';
if(!file_exists(getcwd().$mdfilename)){
// 404
@mattbeck
mattbeck / gist:e4cd732bbf94ff2c865f
Last active Jan 30, 2018
Sample WordPress Data Import Plugin
View gist:e4cd732bbf94ff2c865f
<?php
/**
* Plugin Name: Run-Once Data Importer
* Description: This plugin will add custom field data to a predefined set of posts
* Version: 1.0
* Author: mattbeck
*/
register_activation_hook( __FILE__, 'runonce_data_import' );
You can’t perform that action at this time.