Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @package Habari
*
*/
/**
* Handles Ajax requests, sending them to plugin sinks.
*
*/
RewriteEngine On
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]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteBase /
RewriteRule . index.php [PT]
#!/bin/bash
# setup tmp files from tar.gz's
cd /home/matt/habari-locales/bzr/
bzr merge
bzr add locale/*
bzr commit -m "lp sync"
cd ../
# check fo .po
https://www.google.ca/search?hl=en&tbo=d&output=search&sclient=psy-ab&q=Amore+Grand+Piano&btnI=
GET /search?hl=en&tbo=d&output=search&sclient=psy-ab&q=Amore+Grand+Piano&btnI= HTTP/1.1
Host: www.google.ca
User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20100101 Firefox/17.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
$cronurl = URL::get( 'cron',
array(
'time' => $run_time,
'asyncronous' => Utils::crypt( Options::get( 'GUID' ) ) )
);
$request = new RemoteRequest( $cronurl, 'GET', 100 );
$request->execute();
#! /usr/bin/env php
<?php
/**
* Here we fake a request. set these values appropriate to your
* Habari install.
*
* HABARI_PATH is the full file path to the habari install.
* HABARI_SERVER_NAME is the name (domain) of your habari install.
* HABARI_REQUEST_URI is the URL path to your Habari install. "/" for root.
Apple-PubSub
AppleSyndication
Ask Jeeves/Teoma
Baiduspider
bingbot
Bloglines
BuzzTracker
Charlotte
DoCoMo
Exabot
@MattRead
MattRead / easter-egg.js
Created March 20, 2013 23:56
Javascript to trigger easter egg
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; }
@MattRead
MattRead / gist:5245524
Created March 26, 2013 13:52
twitterlitte
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 / gist:5346862
Last active December 16, 2015 00:19
replace @name with link to comment
<?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) {