Skip to content

Instantly share code, notes, and snippets.

Matt Read MattRead

Block or report user

Report or block MattRead

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 getproject
#!/usr/bin/env php
<?php
$type = trim(shell_exec('zenity --list --radiolist --column=Pick --column=Type TRUE Plugin FALSE Theme FALSE Other'));
switch ($type) {
case 'Plugin':
$repo = trim(shell_exec('zenity --entry --text="Repo Name"'));
$git = shell_exec("cd /home/matt/Projects/plugins; git clone git@github.com:habari-extras/{$repo}.git");
break;
case 'Theme':
View eybase.md

Keybase proof

I hereby claim:

  • I am mattread on github.
  • I am mattread (https://keybase.io/mattread) on keybase.
  • I have a public key whose fingerprint is B79D 293B 4732 9678 DABC 4C2B 9B8E 27DC 9A5F 62E1

To claim this, I am signing this object:

View thunar-paste-to-gist.sh
#!/bin/sh
#
# Paste a file directly to gist.
#
# * Put this file into your home binary dir: ~/bin/
# * Make it executable: chmod +x
#
#
# Required Software:
# -------------------------
View gist:33174bbd8481e267add4
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule ^(archives|blog)/[0-9]+/[0-9]+/(.+)$ $2 [R=301,L]
RewriteRule ^(2005|2004|2006)/[0-9]+/(.+)$ $2 [R=301,L]
RewriteRule ^(css/flag\.php)$ examples/$1 [R=301,L]
RewriteRule ^(projects)/(.+) http://drunkenmonkey.org/$2 [R=301,L]
View test.php
<?php
$url = 'https://api.github.com/repos/MattRead/conquistador/git/blobs/82c300571af3a69609466e51c3f057c75cc1df09';
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6\r\n".
"Cookie: foo=bar\r\n"
)
View gist:5405825
<?php
class MrT extends Plugin
{
public function action_atom_get_collection( $xml, $params, $handler_vars )
{
if ( Controller::get_action() == 'tag_collection' ) {
$xml->title = _t( 'Posts Tagged %s', array( htmlentities(Controller::get_var('tag')) ), 'MrT' );
}
}
View gist:5405724
<?php
action_atom_get_collection {
function b( $xml, $params, $handler_vars ){
$xml->title = 'FFFFFFFFFFFFFFFFFF';
}
}
$a = new AtomHandler; $a->get_collection();
@MattRead
MattRead / gist:5346862
Last active Dec 16, 2015
replace @name with link to comment
View gist:5346862
<?php
public function filter_comment_content_out($content, $comment) {
if (!preg_match_all('#(@[0-9a-zA-Z_]+)\b#i', $content, $matches, PREG_SET_ORDER)) {
return $content;
}
$id = null;
foreach ( $matches as $m ) {
foreach($comment->post->comments as $com) {
View gist:5245524
diff --git a/twitterlitte.plugin.php b/twitterlitte.plugin.php
index 8da3d97..900738f 100644
--- a/twitterlitte.plugin.php
+++ b/twitterlitte.plugin.php
@@ -63,7 +63,7 @@ class TwitterLitte extends Plugin
), '', '&' );
}
else {
- $url = 'http://twitter.com/statuses/user_timeline/' . $block->username . '.json';
+ $url = 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=' . $block->username;
@MattRead
MattRead / easter-egg.js
Created Mar 20, 2013
Javascript to trigger easter egg
View easter-egg.js
var easterEggKeys = new Array('j','i','b','b','y');
var easterEggCurrent = 0;
$(window).keydown(function(e){
var key = String.fromCharCode(e.keyCode).toLowerCase();
if (easterEggKeys[easterEggCurrent].toLowerCase() == key) {
easterEggCurrent++;
if (easterEggCurrent >= easterEggKeys.length) {
$('body').append('<embed src="http://mattread.com/examples/midi/sinfon1.mid" autostart="true" hidden="true" type="audio/midi">');
for (var i = 0; i < document.styleSheets.length; i++) { document.styleSheets[i].disabled = true; }
You can’t perform that action at this time.