swemoney.com

  • Random
  • Archive
  • RSS

Colloquy with CTCP sounds!

I’ve had my mac for almost a full year now. I honestly don’t remember exactly when I got it but I think it was near the end of June or the beginning of July last year. Coming from Linux and Windows meant I had some choices to make about certain applications I was going to use. One of those choices was Colloquy for IRC. One feature I missed from mIRC and XChat was the ability to accept ctcp SOUND requests to play a sound. My friends and I use this in our own channel as an alert system. A trigger is typed that makes a bot send a ctcp SOUND request to the channel with a filename. We each have these sounds locally installed on our computers so we hear the sound after the request is made.

Today I decided to do something about Colloquy’s lack of sound so I started researching some scripting languages supports by the IRC client. I came across F-Script as a cocoa scripting language based on SmallTalk. Since I’ve always wanted to learn SmallTalk, I gave it a go. After a little bit of time, I was able to figure something out to enable sound requests to play sounds from Colloquy!

You can grab the plugin here (right click and save) and throw it in your ~/Library/Application Support/Colloquy/PlugIns directory. Type /fscript load sounds and it should be ready to roll! When a ctcp SOUND request is received, this script will try and find the file in your Sounds folder (i.e. ~/Library/Sounds) and play it automatically for you.

    • #colloquy
    • #irc
    • #fscript
    • #code
  • 3 years ago
  • 18
  • Comments
  • Permalink
  • Share
    Tweet

mephisto_relative_time :: Relative time in a liquid tag

When I signed up for twitter not too long ago, they had a nice item right in their xml file called relative_created_at that would return a time in relation to ‘now’ instead of the ugly ‘created_at’ which is a normal timestamp. The have since removed this item from their xml file (for caching reasons that are very understandable) so I went ahead and created a tiny plugin that provides you with a filter to use that form of time in any of your liquid plugins. You can pass any date as a string and this filter will convert the string to a Ruby date object and return the relative time from now that the date was. Check out the README or the source.

script/plugin install -x http://svn.dnite.org/mephisto_relative_time

The installation is quite easy. Just run the above and restart mephisto. To use the filter in your blog, do one of the following in any liquid template file.

Something happened {{ date_variable | relative_time_ago }} ago.
My birthday was {{ "2006-07-17" | relative_time_ago }} ago.
My birthday is coming up in {{ "2007-07-17" | relative_time_to }}

date_variable is just some liquid variable that contains a string with a date in it. The other 2 are examples that you can create any date in a string as long as Ruby can convert it correctly into a date object. The relative_time_ago function will return how long in the past from now said date happened, and the relative_time_to method will give you roughly how long until said date is reached. Piece of cake, eh? Now have fun with it!

    • #ruby on rails
    • #mephisto
    • #irc
    • #sounds
    • #fscript
    • #scripts
    • #My Stuff
  • 5 years ago
  • Comments
  • Permalink
  • Share
    Tweet
iOS application development, video games, random thoughts, apple. These are a few of the wonderful things you'll catch on my blog.

Pages

  • Projects
  • Apps
  • Secret Browser

Elsewhere

  • @swemoney on Twitter
  • Facebook Profile
  • tehdnite on Youtube
  • dnite on Digg
  • swemoney on Rdio
  • swemoney on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr