Archive

Posts Tagged ‘plugins’

Tracking my workouts on cool charts

November 6th, 2007

I decided today that I wanted to track my calories burned per day on a nice line graph. I did it, and I think I will continue. The total is automatically calculated by the PHP data source. This was made using my Mephisto Plugin for Open Flash Charts.


Uncategorized , , , , , , ,

New Mephisto Post Pinger List

October 6th, 2007

Today I found a nice ping list for Wordpress. I decided to put it into my copy of the Mephisto Post Pinger plugin. I’m not sure if it works yet, but this post will give it a good test.

Read more…


Uncategorized , ,

Flash Video Player for Mephisto

August 13th, 2007

So I made this awesome filter for Mephisto that allows you to easily embed flash videos in your post. May require tweaking if using a non-standard URL root.

It’s as simple as this:


<macro:flash>/assets/2007/8/13/party.flv</macro:flash>

Or, you can make it complicated:


<macro:flash width="640" height="480">/assets/2007/8/13/party.flv</macro:flash>

Which ends up like this:

Installation

Install it from your mephisto directory:


./script/plugin install -x https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/filtered_column_flash_video

Voila! Firebreathing!


Uncategorized , , , , , ,

FireGPG – GnuPG in Firefox’s Gmail!

April 4th, 2007

OK – a little history. I wanted to write this extension some time ago, but couldn’t figure out how to make it work. Apparently, someone has spent the time to find out, and now I have to tear apart the code to find out how they did this. Anyway, this allows you to sign and encrypt any text in Firefox using GPG. It rocks. You can use the options dialog to select the private key to use. It also has support for GMail integration using little buttons instead of the right-click menu which is always available. Here’s a preview:

FireGPG in action

Get FireGPG Here NOW!

Uncategorized , , , ,

Mephisto Comment Notification Mod

March 19th, 2007

I wanted to be able to click a link in my email to see the comment it talked about. So, I modified Luke Redpath’s Comment Notification Plugin to give that to me. First, I had to do some script/console action:


>> s = Site.find_first
=> #<Site:0xb747e014 @attributes={"current_theme_path"=>"wibbish-mephisto",#...
#...
>> s.host='www.ralree.info'
=> "www.ralree.info"
>> s.save
=> true
>> quit

Next, I did a small model modification:


# app/models/article.rb, in the public section
  def full_external_link
    ["http://", site.host, full_permalink].join("")
  end

And a slight test:


Loading production environment.
>> Article.find_first.full_external_link
=> "http://www.ralree.info/2006/5/21/first-post-what-to-say"

Perfect!

Then, I just modified the view for the email a bit:


# vendor/plugins/mephisto_comment_notification/lib/views/
# comment_notifier/comment_notification.rhtml
A new comment has been posted on your blog for the article '<%= @comment.article.title %>' by <%= @comment.author %> (<%= @comment.author_email %>):
<%= @comment.article.full_external_link %>

The commenter IP address is <%= @comment.author_ip %>.

Here is the comment that was posted:

"<%= @comment.body %>"

This notification was sent using the Mephisto Comment notification plugin by Luke Redpath.

http://opensource.agileevolved.com/svn/root/rails_plugins/mephisto_comment_notification/trunk

Modified awesomely by Erik Gregg (http://www.ralree.info)

And it’s magic! It totally works!

Uncategorized , , ,

Fixing Mephisto Post Pinger Plugin

March 2nd, 2007

I wanted some places to get pinged when I posted. I used the mephisto_post_ping plugin, I simply changed the directory structure and class definition around:

Directory Structure


./lib/article_ping_observer.rb
./lib/mephisto_plugins/post_ping.rb
./lib/config.rb
./README
./init.rb

File Changes

init.rb


# $Id$
require 'mephisto_plugins/post_ping'
ActiveRecord::Base.observers << :article_ping_observer

plugin.rb


module Mephisto
  module Plugins
    class PostPinger < Mephisto::Plugin
      author 'Mark Guzman'
      version '$Rev: 82 $'.gsub( "Rev: ", "" )
      notes "Send Weblogs Pings when articles are published"
      homepage "http://hasno.info/2006/11/11/mephisto-plugins"

      class Schema < ActiveRecord::Migration
        def self.install
        end

        def self.uninstall
        end
      end

    end
  end
end

That’s all I changed. This is my first post since the change, so I’ll see if it works. If not, at least Mephisto doesn’t blow up on startup.

Results

Well,


unable to send xmlrpc weblog ping -> http://www.ralree.info
unable to send xmlrpc weblog ping -> http://www.ralree.info
unable to send xmlrpc weblog ping -> http://www.ralree.info
unable to send xmlrpc weblog ping -> http://www.ralree.info

Seems like a couple might have worked. I’ll keep working on it. But, at least it gets called.

RubyCorner worked!

Uncategorized , , , ,

How to make a Mephisto Plugin

February 26th, 2007

So, I figured I might as well provide a quick tutorial on how to make Mephisto Plugins currently. Many of the old plugins are broken, so there needs to be a resurgence of plugin development. Here’s the basic structure of the Tag Cloud plugin:


mephisto_tag_cloud
 - init.rb README
 - lib
   - mephisto_plugins
     - tag_cloud.rb

As you can see, the structure is very simple. Here’s my code for init.rb


Liquid::Template.register_filter(MephistoPlugins::TagCloud)

That’s it! No require or anything! Next, I edited lib/mephisto_plugins/tag_cloud.rb:


module MephistoPlugins
  module TagCloud
    def size_tag(tag, largest = 2)
      size = (Tag.find_by_name(tag).taggings(true).length + 18).to_f / 18
      size = largest if size > largest
      "<span style='font-size: #{size}em'><a href='/tags/#{tag}'>#{tag}</a></span>"
    end
  end
end

Holy crap that barely any code at all! So, the moral of the story is that it’s very easy to make the plugins once you figure out what to do.

Uncategorized , , , , ,

Mephisto Tag Cloud Plugin

February 25th, 2007

Because the French one disappeared off the face of the earth, I took it upon myself to make a tag cloud Liquid plugin. Here’s the scoop. I downloaded Rick’s MeasureMap Plugin and went to town converting it.

Add this to your sidebar in your liquid template of choice:


{% for tag in site.tags %}
  {{ tag | size_tag }}
{% endfor %}

And you should have some awesome tag_cloud action. You can specify an upper limit as well:


{{ tag | size_tag: 3 }}

That code allows for up to 4em font size. I don’t recommend this because it’s ludicrous. The default upper limit is 2em, which makes the font size range between 1em and 2em. Suggestions are welcome.

Get it here:


svn co https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/mephisto_tag_cloud

Or install it like this:


./script/plugin install https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/mephisto_tag_cloud

Works for me – let me know if you have any difficulties.

Update: French one re-appears!

Well, he’s back. It was down a while back. You can see his version here. I like mine better. :P

Update: Better SELECT Statement

Thanks to Todd for pointing out that the tags were applying to not only published articles, but drafts as well, which produced false tag counts. He also pointed out that they were applying to revisions, which was unacceptable. I think I fixed the problems using some straight up SQL:


    def size_tag(tag, largest = 2, smallest = 0.5)
      number = ActiveRecord::Base.count_by_sql(
        ["SELECT COUNT(*) FROM taggings,
            tags, contents WHERE
            tags.name = ? AND taggings.tag_id = tags.id
            AND contents.id = taggings.taggable_id
            AND contents.published_at IS NOT NULL;", tag])
      size = sprintf("%0.2f", number.to_f / 5)
      size = size.to_f > largest ? largest : size.to_f < smallest ? smallest : size

This is simple – I’m just adding some conditions that filter unpublished articles and revisions (which I don’t think actually appear in the contents table anyway). In a test, the linux tag returned 35 results the old way, 34 without the checking of published_id, and 33 as it is above. I think it’s filtering, but Todd will have to confirm this.

Uncategorized , , , ,

XKCD Typo Sidebar

January 28th, 2007

I made a sweet sidebar today that I’ve been wanting to make for a long time. I usually forget to head over to XKCD, so I wanted a way to have the newest images staring me in the face all the time. Now, thanks to the magic of RSS, they’re right in front of me. They are lightboxed, so I have the newest comics and their captions available to me without even leaving my own site. How homey. To get the sidebar (works in Typo svn rev. 1246, which is my crusty old checkout), do this wherever your plugins are kept:


svn co http://modzer0.cs.uaf.edu/repos/hank/code/ruby/typo/xkcd_sidebar/

Horray! A sidebar is born.

Uncategorized , , , ,

Graticule: Geocoding on Rails

January 26th, 2007

I’ve been using Graticule for geocoding in a Rails project at work, and I decided I needed to make some changes. So, I turned the Graticule gem into a plugin. It’s available here:


./script/plugin install -x https://modzer0.cs.uaf.edu/repos/hank/code/ruby/graticule_plugin

It’s as simple as that. Then just jam this into your environment and change it accordingly:


GEOCODERS = [
  Graticule.service(:google).new('google_key'),
  Graticule.service(:yahoo).new('yahoo_key'),
  Graticule::GeocoderUsGeocoder.new,
  Graticule::MetaCartaGeocoder.new
]

Then you can just perform looping on GEOCODERS to do your queries on every site.
There’s also some other changes you can do to catch Graticule::AddressError, but I won’t go into those here.

Uncategorized , , ,