strip metadata from post bodies

This commit is contained in:
Sami Samhuri 2014-02-15 18:18:23 -08:00
parent b73a290903
commit 7904fddaae
106 changed files with 1 additions and 742 deletions

View file

@ -1,10 +1,3 @@
Title: First Post!
Date: February 8, 2006
Timestamp: 1139368860
Author: sjs
Tags: life
----
so it's 2am and i should be asleep, but instead i'm setting up a blog. i got a new desk last night and so today i finally got my apartment re-arranged and it's much better now. that's it for now... time to sleep.
(speaking of sleep, this new <a href="http://www.musuchouse.com/">sleeping bag</a> design makes so much sense. awesome.)

View file

@ -1,10 +1,3 @@
Title: Touch Screen on Steroids
Date: February 8, 2006
Timestamp: 1139407560
Author: sjs
Tags: technology, touch
----
If you thought the PowerBook's two-finger scrolling was cool check out this touch screen:
<a href="http://mrl.nyu.edu/~jhan/ftirtouch/">Multi-Touch Interaction Research</a>

View file

@ -1,10 +1,3 @@
Title: Urban Extreme Gymnastics?
Date: February 15, 2006
Timestamp: 1140028860
Author: sjs
Tags: amusement
----
This crazy russian goes all over the place scaling buildings, doing all sorts of flips, bouncing off the walls literally. He'd be impossible to catch.
<a href="http://www.videobomb.com/posts/show/46">Russian parkour (urban extreme gymnastics)</a>

View file

@ -1,10 +1,3 @@
Title: Girlfriend X
Date: February 18, 2006
Timestamp: 1140292200
Author: sjs
Tags: crazy, funny
----
This is hilarious! Someone wrote software that manages a "parallel" dating style.
> In addition to storing each woman's contact information and picture, the Girlfriend profiles include a Score Card where you track her sexual preferences, her menstrual cycles and how she styles her pubic hair.

View file

@ -1,8 +1 @@
Title: Jump to view/controller in TextMate
Date: February 18, 2006
Timestamp: 1140303060
Author: sjs
Tags: hacking, rails, textmate, rails, textmate
----
<a href="http://blog.inquirylabs.com/2006/02/17/controller-to-view-and-back-again-in-textmate/trackback/">Duane</a> came up with a way to jump to the controller method for the view you're editing, or vice versa in TextMate while coding using Rails. This is a huge time-saver, thanks!

View file

@ -1,10 +1,3 @@
Title: Some TextMate snippets for Rails Migrations
Date: February 18, 2006
Timestamp: 1140331680
Author: sjs
Tags: textmate, rails, hacking, rails, snippets, textmate
----
My arsenal of snippets and macros in TextMate is building as I read through the rails canon, <a href="http://www.pragmaticprogrammer.com/titles/rails/" title="Agile Web Development With Rails">Agile Web Development...</a> I'm only 150 pages in so I haven't had to add much so far because I started with the bundle found on the <a href="http://wiki.rubyonrails.org/rails/pages/TextMate">rails wiki</a>. The main ones so far are for migrations.
Initially I wrote a snippet for adding a table and one for dropping a table, but I don't want to write it twice every time! If I'm adding a table in **up** then I probably want to drop it in **down**.

View file

@ -1,11 +1,3 @@
Title: Obligatory Post about Ruby on Rails
Date: February 20, 2006
Timestamp: 1140424260
Author: sjs
Tags: rails, coding, hacking, migration, rails, testing
Styles: typocode
----
<p><em>I'm a Rails newbie and eager to learn. I welcome any suggestions or criticism you have. You can direct them to <a href="mailto:sjs@uvic.ca">my inbox</a> or leave me a comment below.</em></p>
<p>I finally set myself up with a blog. I mailed my dad the address and mentioned that it was running <a href="http://www.typosphere.org/">Typo</a>, which is written in <a href="http://www.rubyonrails.com/">Ruby on Rails</a>. The fact that it is written in Rails was a big factor in my decision. I am currently reading <a href="http://www.pragmaticprogrammer.com/titles/rails/">Agile Web Development With Rails</a> and it will be great to use Typo as a learning tool, since I will be modifying my blog anyways regardless of what language it's written in.</p>

View file

@ -1,10 +1,3 @@
Title: TextMate Snippets for Rails Assertions
Date: February 20, 2006
Timestamp: 1140508320
Author: sjs
Tags: textmate, rails, coding, rails, snippets, testing, textmate
----
This time I've got a few snippets for assertions. Using these to type up your tests quickly, and then hitting **⌘R** to run the tests without leaving TextMate, makes testing your Rails app that much more convenient. Just when you thought it was already too easy! (Don't forget that you can use **⌥⌘↓** to move between your code and the corresponding test case.)
This time I'm posting the .plist files to make it easier for you to add them to TextMate. All you need to do is copy these to **~/Library/Application Support/TextMate/Bundles/Rails.tmbundle/Snippets**.

View file

@ -1,11 +1,3 @@
Title: TextMate: Insert text into self.down
Date: February 21, 2006
Timestamp: 1140562500
Author: sjs
Tags: textmate, rails, hacking, commands, macro, rails, snippets, textmate
Styles: typocode
----
<p><em><strong>UPDATE:</strong> I got everything working and it's all packaged up <a href="2006.02.22-intelligent-migration-snippets-0.1-for-textmate">here</a>. There's an installation script this time as well.</em></p>
<p>Thanks to <a href="http://thread.gmane.org/gmane.editors.textmate.general/8520">a helpful thread</a> on the TextMate mailing list I have the beginning of a solution to insert text at 2 (or more) locations in a file.</p>

View file

@ -1,10 +1,3 @@
Title: TextMate: Move selection to self.down
Date: February 21, 2006
Timestamp: 1140510360
Author: sjs
Tags: textmate, rails, hacking, hack, macro, rails, textmate
----
<p><strong>UPDATE:</strong> <em>This is obsolete, see <a href="2006.02.21-textmate-insert-text-into-self-down">this post</a> for a better solution.</em></p>
<p><a href="2006.02.18-some-textmate-snippets-for-rails-migrations.html#comment-3">Duane's comment</a> prompted me to think about how to get the <code>drop_table</code> and <code>remove_column</code> lines inserted in the right place. I don't think TextMate's snippets are built to do this sort of text manipulation. It would be nicer, but a quick hack will suffice for now.</p><p>Use <acronym title="Migration Create and Drop Table">MCDT</acronym> to insert:</p>

View file

@ -1,10 +1,3 @@
Title: Intelligent Migration Snippets 0.1 for TextMate
Date: February 22, 2006
Timestamp: 1140607680
Author: sjs
Tags: mac os x, textmate, rails, hacking, migrations, snippets
----
*This should be working now. I've tested it under a new user account here.*
*This does requires the syncPeople bundle to be installed to work. That's ok, because you should get the [syncPeople on Rails bundle][syncPeople] anyways.*

View file

@ -1,11 +1,3 @@
Title: SJ's Rails Bundle 0.2 for TextMate
Date: February 23, 2006
Timestamp: 1140743880
Author: sjs
Tags: textmate, rails, coding, bundle, macros, rails, snippets, textmate
Styles: typocode
----
Everything that you've seen posted on my blog is now available in one bundle. Snippets for Rails database migrations and assertions are all included in this bundle.
There are 2 macros for class-end and def-end blocks, bound to <strong>⌃C</strong> and <strong>⌃D</strong> respectively. Type the class or method definition, except for <code>class</code> or <code>def</code>, and then type the keyboard shortcut and the rest is filled in for you.

View file

@ -1,8 +1 @@
Title: Generate self.down in your Rails migrations
Date: March 3, 2006
Timestamp: 1141450680
Author: sjs
Tags: rails, textmate, migrations, rails, textmate
----
<a href="http://lunchboxsoftware.com/">Scott</a> wrote a really <a href="http://lunchroom.lunchboxsoftware.com/articles/2005/11/29/auto-fill-your-reverse-migrations">cool program</a> that will scan `self.up` and then consult db/schema.rb to automatically fill in `self.down` for you. Brilliant!

View file

@ -1,10 +1,3 @@
Title: I don't mind FairPlay either
Date: March 3, 2006
Timestamp: 1141451760
Author: sjs
Tags: apple, mac os x, life, drm, fairplay, ipod, itunes
----
I think that <a href="http://jim.roepcke.com/2006/03/02#item7471">Jim is right</a> about Apple's DRM not being all that evil.
I buy music from the iTunes Music Store *because* I bought an iPod. The fact I can't play them on another device doesn't matter to me. With my purchased songs I can:

View file

@ -1,10 +1,3 @@
Title: Spore
Date: March 3, 2006
Timestamp: 1141450980
Author: sjs
Tags: amusement, technology, cool, fun, games
----
<a href="http://video.google.com/videoplay?docid=8372603330420559198&amp;q=spore">This game</a> that <a href="http://jim.roepcke.com/">Jim</a> <a href="http://jim.roepcke.com/2006/03/01#item7470">blogged about</a> is probably the coolest game I've seen.
You really just have to watch the video, I won't bother explaining it here. I don't really play games much, but this I would play.

View file

@ -1,10 +1,3 @@
Title: zsh terminal goodness on OS X
Date: April 4, 2006
Timestamp: 1144187820
Author: sjs
Tags: mac os x, apple, osx, terminal, zsh
----
<a href="http://www.apple.com/">Apple</a> released the <a href="http://docs.info.apple.com/article.html?artnum=303411">OS X 10.4.6 update</a> which fixed a <strong>really</strong> annoying bug for me. Terminal (and <a href="http://iterm.sourceforge.net/">iTerm</a>) would fail to open a new window/tab when your shell is <a href="http://zsh.sourceforge.net/">zsh</a>. iTerm would just open then immediately close the window, while Terminal would display the message: <code>[Command completed]</code> in a now-useless window.
Rebooting twice to get the fix was reminiscent of <a href="http://www.microsoft.com/windows/default.mspx">Windows</a>, but well worth it.

View file

@ -1,8 +1 @@
Title: OS X and Fitt's law
Date: May 7, 2006
Timestamp: 1147059780
Author: sjs
Tags: mac os x, apple, mac, os, usability, x
----
I've realized that OS X really does obey Fitt's law in all 4 corners now. Apple menu in the top left, Spotlight top right, and the bottom 2 are always accessible for drag n drop, unless the dock is hidden. I rarely ever use it because I usually have pretty good chunks of the desktop showing, but it is useful.

View file

@ -1,10 +1,3 @@
Title: WikipediaFS on Linux, in Python
Date: May 7, 2006
Timestamp: 1147060140
Author: sjs
Tags: hacking, python, linux, fuse, linux, mediawiki, python, wikipediafs
----
Till now I've been using my own version of <a href="http://meta.wikimedia.org/wiki/Pywikipedia">pywikipedia</a> for scripting MediaWiki, and it works well. But I read about <a href="http://wikipediafs.sourceforge.net/">WikipediaFS</a> and had to check it out. It's a user space filesystem for Linux that's built using the <a href="http://fuse.sourceforge.net/wiki/index.php/LanguageBindings">Python bindings</a> for <a href="http://fuse.sourceforge.net/">FUSE</a>. What it does is mounts a filesystem that represents your wiki, with articles as text files. You can use them just like any other files with mv, cp, ls, vim, and so on.
There hasen't been any action on that project for 13 months though, and it doesn't work on my wiki (MediaWiki 1.4.15) so I'm going to try and make it work after I upgrade to MediaWiki 1.6.3 tonight. This will be pretty cool when it works. I haven't looked at the code yet but it's only 650 lines.

View file

@ -1,10 +1,3 @@
Title: Ich bin Ausländer und spreche nicht gut Deutsch
Date: June 5, 2006
Timestamp: 1149527460
Author: sjs
Tags: life, munich, seekport, work
----
How's this for an update: I'm working in Munich for the summer at a European search engine called <a href="http://www.seekport.co.uk/">Seekport</a>. The search engine isn't all they do, as right now I'm programming a desktop widget that shows live scores &amp; news from World Cup matches (in English and Arabic). I'm building it on top of the <a href="http://widgets.yahoo.com/">Yahoo! Widget Engine</a> because it needs to run on Windows. Even though I quite like the Y! Engine, I would still prefer to be coding in straight HTML, CSS & JavaScript like Dashboard programmers get to use. The Y! Engine uses XML (it is somewhat HTML-like) and JavaScript.
The place I'm living in is like a dormitory for younger people. I share a bathroom & kitchen with a German guy named Sebastian who is 21 and an artist; a stonecutter actually. I only met him briefly yesterday, but he seems nice. I'm going to teach him English, and he'll teach me German, though his English is much better than my German. It's a pretty quiet place, and we get breakfast included, dinner can be bought for €2,50, and Internet access is included as well. I brought my Mac Mini with me, and as soon as I find an AC adapter I'll be ready to go with the 'net at home. I probably won't blog again till then, since I'm at work right now.

View file

@ -1,10 +1,3 @@
Title: Never buy a German keyboard!
Date: June 9, 2006
Timestamp: 1149841020
Author: sjs
Tags: apple, apple, german, keyboard
----
Nothing personal, but the backtick/tilde is located where the rest of the left shift key should be, and the return key is double-height, forcing the backslash/bar to the right of the dash/underscore (that'd be the apostrophe/double quote for pretty much everyone else who types qwerty). Note that I'm talking about using a German keyboard with an English layout. The German layout is flat out impossible for coding.
<a href="/images/keyboard.jpg"><img src="/images/keyboard.jpg" title="German Apple Keyboard" alt="German Apple Keyboard"></a>

View file

@ -1,10 +1,3 @@
Title: There's nothing regular about regular expressions
Date: June 10, 2006
Timestamp: 1149928080
Author: sjs
Tags: technology, book, regex
----
I'm almost half way reading Jeffrey Friedl's book <a href="http://www.oreilly.com/catalog/regex2/">Mastering Regular Expressions</a> and I have to say that for a book on something that could potentially bore you to tears, he really does an excellent job of keeping it interesting. Even though a lot of the examples are contrived (I'm sure out of necessity), he also uses real examples of regexes that he's actually used at <a href="http://www.yahoo.com/">Yahoo!</a>.
As someone who has to know how everything works it's also an excellent lesson in patience, as he frequently says "here, take this knowledge and just accept it for now until I can explain why in the next chapter (or in 3 chapters!)". But it's all with good reason and when he does explain he does it well.

View file

@ -1,8 +1 @@
Title: Apple pays attention to detail
Date: June 11, 2006
Timestamp: 1150014600
Author: sjs
Tags: technology, mac os x, apple
----
I think this has to be one of the big reasons why people who love their Mac, love their Mac (or other Apple product). I usually just have cheap PC speakers plugged into my Mac mini, but I didn't bring any with me to Munich and the internal Mac mini speaker isn't very loud, so I'm using headphones to watch movies. My Mac remembers the volume setting when the headphones ore plugged in, and when they're not, so I don't accidentally blow my ears. It's like my iPod pausing when the headphones are unplugged. It's excruciating attention to the smallest, (seemingly) most unimportant detail. I love it, and I'm hooked.

View file

@ -1,10 +1,3 @@
Title: Working with the Zend Framework
Date: July 6, 2006
Timestamp: 1152196560
Author: sjs
Tags: coding, technology, php, framework, php, seekport, zend
----
At <a href="http://www.seekport.co.uk/">Seekport</a> I'm currently working on an app to handle
the config of their business-to-business search engine. It's web-based and I'm using PHP, since
that's what they're re-doing the front-end in. Right now it's a big mess of Perl, the main

View file

@ -1,10 +1,3 @@
Title: Ubuntu: Linux for Linux users please
Date: July 13, 2006
Timestamp: 1152804840
Author: sjs
Tags: linux, linux, ubuntu
----
<a href="http://www.ubuntu.com/">Ubuntu</a> is a fine Linux distro, which is why it's popular. I still use <a href="http://www.gentoo.org/">Gentoo</a> on my servers but Ubuntu is fast to set up for a desktop. Linux for humans it certainly is, but dammit sometimes I want Linux like I'm used to.
It should ship with build-essentials (gcc & others) installed. It *shouldn't* ask me if I'm sure I want to restart at the GDM login screen. I have no session open and already clicked twice to choose Restart.

View file

@ -1,10 +1,3 @@
Title: Ruby and Rails have spoiled me rotten
Date: July 17, 2006
Timestamp: 1153140000
Author: sjs
Tags: rails, ruby, php, coding, framework, php, rails, ruby, zend
----
It's true. I'm sitting here coding in PHP using the <a href="http://framework.zend.com/">Zend Framework</a> and all I can think about is how much nicer Rails is, or how much easier it is to do [x] in Ruby. It's not that the Zend Framework is bad or anything, it's quite nice, but you just can't match Ruby's expressiveness in a language like PHP. Add the amazing convenience Rails builds on top of Ruby and that's a really hard combo to compete with.
I'd love to be using mixins instead of mucking around with abstract classes and interfaces, neither of which will just let you share a method between different classes. Writing proxy methods in these tiny in-between classes is annoying. (ie. inherit from Zend_class, then my real classes inherit from the middle-man class) I *could* add things to Zend's classes, but then upgrades are a bitch. I miss Ruby. I could use something like <a href="http://www.advogato.org/article/470.html">whytheluckystiff's PHP mixins</a>, which is a clever hack, but still a hack.

View file

@ -1,10 +1,3 @@
Title: Late static binding
Date: July 19, 2006
Timestamp: 1153329780
Author: sjs
Tags: php, coding, coding, php
----
*Update: This has <a href="http://www.php.net/~derick/meeting-notes.html#late-static-binding-using-this-without-or-perhaps-with-a-different-name">been discussed</a> and will be uh, sort of fixed, in PHP6. You'll be able to use static::my_method() to get the real reference to self in class methods. Not optimal, but still a solution I guess.*
As colder on ##php (freenode) told me today, class methods in PHP don't have what they call late static binding. What's that? It means that this code:

View file

@ -1,10 +1,3 @@
Title: Class method? Instance method? It doesn't matter to PHP
Date: July 21, 2006
Timestamp: 1153493760
Author: sjs
Tags: php, coding
----
*Update: This has <a href="http://www.php.net/~derick/meeting-notes.html#method-calls">been discussed</a> for PHP6. A little late, but I guess better than never.*
I made a mistake while I was coding, for shame! Anyway this particular mistake was that I invoked a class method on the wrong class. The funny part was that this method was an instance method in the class which I typed by mistake. In the error log I saw something like "Invalid use of $this in class function."

View file

@ -1,8 +1 @@
Title: Where are my headphones?
Date: August 22, 2006
Timestamp: 1156257060
Author: sjs
Tags: life, seekport
----
Some people left Seekport this month and 2 of the remaining employees moved into the office Im working in. Thats fine, and Im leaving at the end of the week, but man Im going crazy. This guys pounding on his keyboard like its a fucking whack-a-mole game! I dont know what kind of keyboard he learned to type on but it mustve been horrible. It sounds like he must go through at least 10 of those things in a year. I dont know if Ill make it till Friday without yelling "AGH! STOP THE MADNESS YOU CRAZY BASTARD YOU JUST HAVE TO TOUCH THE KEYS!"

View file

@ -1,10 +1,3 @@
Title: Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
Date: September 16, 2006
Timestamp: 1158469860
Author: sjs
Tags: amusement, buffalo
----
Wouldn't the sentence 'I want to put a hyphen between the words Fish and And and And and Chips in my Fish-And-Chips sign' have been clearer if quotation marks had been placed before Fish, and between Fish and and, and and and And, and And and and, and and and And, and And and and, and and and Chips, as well as after Chips?
<a href="http://en.wikipedia.org/wiki/Buffalo_buffalo_buffalo_buffalo_buffalo_buffalo_buffalo_buffalo">Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo</a>

View file

@ -1,10 +1,3 @@
Title: Some features you might have missed in iTunes 7
Date: September 22, 2006
Timestamp: 1158969540
Author: sjs
Tags: apple, apple, itunes
----
<img src="/images/menu.png" style="float: right; margin: 10px;" title="New menu" alt="New menu">
Besides the <a href="http://www.tuaw.com/2006/09/12/walkthrough-itunes-7s-big-new-features/">big changes</a> in <a href="http://www.apple.com/itunes">iTunes 7</a> there have been some minor changes that are still pretty useful.

View file

@ -1,10 +1,3 @@
Title: Coping with Windows XP activiation on a Mac
Date: December 17, 2006
Timestamp: 1166427000
Author: sjs
Tags: parallels, windows, apple, mac os x, bootcamp
----
**Update:** This needs to be run at system startup, before you log in. I have XP Home and haven't been able to get it to run that way yet.
I can't test my method until I get XP Pro, if I get XP Pro at all. However chack left a <a href="2006.12.17-coping-with-windows-xp-activiation-on-a-mac.html#comment-1">comment</a> saying that he got it to work on XP Pro, so it seems we've got a solution here.

View file

@ -1,10 +1,3 @@
Title: Full-screen Cover Flow
Date: March 6, 2007
Timestamp: 1173217860
Author: sjs
Tags: apple, coverflow, itunes
----
<a href="http://www.apple.com/itunes/jukebox/coverflow.html">Cover Flow</a> now comes in a full-screen flavour. It's pretty sweet, but unfortunately the remote controls iTunes exactly the same so you need a mouse to flick through the covers.
That made me wonder if Front Row used this full-screen Cover Flow view for albums now, but it doesn't. I hope Apple gets on this and adds it to Front Row and the Apple TV. I'm sure it's already on their list.

View file

@ -1,10 +1,3 @@
Title: Digg v4: Reply to replies (Greasemonkey script)
Date: March 8, 2007
Timestamp: 1173424740
Author: sjs
Tags: coding, digg, firefox, userscript
----
It's nearly identical to <a href="http://userscripts.org/scripts/show/4664">the previous one</a> but works with Digg v4 and should be slightly more efficient. I'm working on making it faster because I believe it is quite inefficient as it is. It was David Bendit's (the original author) first script though so kudos to him for starting this thing because I love it. I just hate a slow greasemonkey script on pages with hundreds of comments.
Please leave me some comments if you appreciate this, or have any feedback on the code.

View file

@ -1,10 +1,3 @@
Title: Diggscuss 0.9
Date: March 25, 2007
Timestamp: 1174834980
Author: sjs
Tags: coding, digg, firefox, userscript
----
The biggest change is that it uses XPath for the dirty work, which makes it quite a bit more readable. It's 100 lines longer than the previous version, but it does twice as much.
Now both a [reply] and a [quote] link are added to each comment. Replying to parent comments now adds @username: to the comment field as well as the links added by the script.

View file

@ -1,10 +1,3 @@
Title: A triple-booting, schizophrenic MacBook
Date: April 4, 2007
Timestamp: 1175754600
Author: sjs
Tags: linux, mac os x, windows
----
The steps are well documented so I wont get into detail here but if you have a backup and can wipe your disk all you do is:
* Install OS X to a single partition filling your disk (optionally use your existing OS X intall)

View file

@ -1,10 +1,3 @@
Title: ActiveRecord::Base.find_or_create and find_or_initialize
Date: April 11, 2007
Timestamp: 1176287040
Author: sjs
Tags: activerecord, coding, rails, ruby
----
I've extended ActiveRecord with `find_or_create(params)` and `find_or_initialize(params)`. Those are actually just wrappers around `find_or_do(action, params)` which does the heavy lifting.
They work exactly as you'd expect them to work with possibly one gotcha. If you pass in an `id` attribute then it will just find that record directly. If it fails it will try and find the record using the other params as it would have done normally.

View file

@ -1,10 +1,3 @@
Title: Getting to know Vista
Date: April 16, 2007
Timestamp: 1176746940
Author: sjs
Tags: windows
----
### It looks pretty good! ###
After figuring out how to minimise the translucency of the window decorations I think Aero looks ok. Window titles, on both windows and the taskbar, can be difficult to read at a glance which is really stupid if you ask me. But its better than Luna! They really lay the effects on thick but overall I find it pretty pleasant and it runs well on my MacBooks Intel 945 video chip.

View file

@ -1,10 +1,3 @@
Title: Quickly inserting millions of rows with MySQL/InnoDB
Date: April 26, 2007
Timestamp: 1177596360
Author: sjs
Tags: linux, mysql
----
The absolute first thing you should do is check your MySQL configuration to make sure its sane for the system youre using. I kept getting a The table is too large error on my Gentoo box after inserting several million rows because the default config limits the InnoDB tablespace size to 128M. It was also tuned for a box with as little as 64M of RAM. Thats cool for a small VPS or your old Pentium in the corner collecting dust. For a modern server, workstation, or even notebook with gigs of RAM youll likely want to make some changes.
### Tweaking my.cnf ###

View file

@ -1,10 +1,3 @@
Title: Funny how code can be beautiful
Date: April 30, 2007
Timestamp: 1177942020
Author: sjs
Tags: haskell
----
While reading a <a href="http://www.haskell.org/tutorial/index.html">Haskell tutorial</a> I came across the following code for defining the <a href="http://en.wikipedia.org/wiki/Fibonacci_number">Fibonacci numbers</a>:
fib = 1 : 1 : [ a + b | (a, b) <- zip fib (tail fib) ]

View file

@ -1,10 +1,3 @@
Title: Typo and I are friends again
Date: May 1, 2007
Timestamp: 1178081497
Author: sjs
Tags: typo
----
<p>I've been really frustrated with <a href="http://www.typosphere.org/">Typo</a> recently. For some reason changing my <a href="2007.04.30-funny-how-code-can-be-beautiful">last post</a> would cause MySQL to timeout and I'd have to kill the rogue ruby process manually before any other changes to the DB would work, instead of hanging for a minute or two then timing out. Luckily I was able to disable the post using the command line client, the bug only manifested itself when issuing an UPDATE with all the fields present. Presumably the body was tripping things up because most other fields are simple booleans, numbers, or very short strings.
Add to that the random HTTP 500 errors which were very noticeable while I was trying to fix that post and I was about to write my own blog or switch to WordPress.

View file

@ -1,10 +1,3 @@
Title: A Scheme parser in Haskell: Part 1
Date: May 3, 2007
Timestamp: 1178178470
Author: sjs
Tags: coding, haskell
----
From <a href="http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/firststeps.html">Write Yourself a Scheme in 48 hours</a>:
<blockquote>

View file

@ -1,10 +1,3 @@
Title: A New Way to Look at Networking
Date: May 5, 2007
Timestamp: 1178406600
Author: sjs
Tags: technology, networking
----
<a href="http://en.wikipedia.org/wiki/Van_Jacobson">Van Jacobson</a> gave a <a href="http://video.google.com/videoplay?docid=-6972678839686672840">Google Tech Talk</a> on some of his ideas of how a modern, global network could work more effectively, and with more trust in the data which changes many hands on its journey to its final destination.
<div style="width:100%;text-align:center;">

View file

@ -1,10 +1,3 @@
Title: Gotta Love the Ferry Ride
Date: May 5, 2007
Timestamp: 1178364300
Author: sjs
Tags: life, photo, bc, victoria
----
I lived in <a href="http://en.wikipedia.org/wiki/Victoria%2C_British_Columbia">Victoria</a> for over a year before I ever rode the <a href="http://www.bcferries.com/">ferry</a> between <a href="http://en.wikipedia.org/wiki/Vancouver_Island">Vancouver Island</a> and <a href="http://en.wikipedia.org/wiki/Tsawwassen">Tsawwassen</a> (ignoring the time I was in BC with my family about 16 years ago, that is). I always just flew in and out of Victoria directly. The ferry is awesome and the view is incredible, navigating through all those little islands. Last time I rode the ferry I snapped this shot. It's possibly the best picture I've taken on that trip.
<a href="http://sami.samhuri.net/files/original.jpg" class="photo"><img src="http://sami.samhuri.net/files/small.jpg" title="Sunset" alt="Sunset" /></a>

View file

@ -1,10 +1,3 @@
Title: dtrace + Ruby = Goodness for Sun
Date: May 9, 2007
Timestamp: 1178725500
Author: sjs
Tags: ruby, dtrace, sun
----
Suddenly I feel the urge to try out Solaris for i386 again. Last time I gave it a shot was when it was first released, and all I ever got out of the CD was a white screen. It's been 2-3 years since then and it should be well-tested. I'll try to install it into a VM first using the ISO and potentially save myself a CD. (I don't even think I have blank CDs lying around anymore, only DVDs.)
<a href="http://joyeur.com/2007/05/07/dtrace-for-ruby-is-available">The culprit.</a>

View file

@ -1,10 +1,3 @@
Title: I Can't Wait to See What Trey Parker & Matt Stone Do With This
Date: May 9, 2007
Timestamp: 1178746440
Author: sjs
Tags: crazy
----
I'd just like to say, <a href="http://news.com.com/8301-10784_3-9717828-7.html">bwa ha ha ha!</a>
Summary: Paris Hilton drove with a suspended license and is facing 45 days in jail. Now she's reaching out to lord knows who on her MySpace page to petition The Governator to pardon her. I might cry if I weren't pissing myself laughing.

View file

@ -1,10 +1,3 @@
Title: Enumurable#pluck and String#to_proc for Ruby
Date: May 10, 2007
Timestamp: 1178838840
Author: sjs
Tags: ruby, extensions
----
I wanted a method analogous to Prototype's <a href="http://prototypejs.org/api/enumerable/pluck">pluck</a> and <a href="http://prototypejs.org/api/enumerable/invoke">invoke</a> in Rails for building lists for <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000510">options_for_select</a>. Yes, I know about <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000511">options_from_collection_for_select</a>.
I wanted something more general that I can use anywhere - not just in Rails - so I wrote one. In a second I'll introduce <code>Enumerable#pluck</code>, but first we need some other methods to help implement it nicely.
@ -122,4 +115,4 @@ I wrote another version without using the various <code>#to_proc</code> methods
It's just icing on the cake considering Ruby's convenient block syntax, but there it is. Do with it what you will. You can change or extend any of these to support drilling down into hashes quite easily too.
*<strong>Update #1:</strong> Fixed a potential performance issue in <code>Enumerable#to_proc</code> by saving the results of <code>to_proc</code> in <tt>@procs</tt>.*
*<strong>Update #1:</strong> Fixed a potential performance issue in <code>Enumerable#to_proc</code> by saving the results of <code>to_proc</code> in <tt>@procs</tt>.*

View file

@ -1,10 +1,3 @@
Title: Rails Plugins (link dump)
Date: May 10, 2007
Timestamp: 1178756520
Author: sjs
Tags: rails
----
Some Rails plugins I find useful:
* <a href="http://matthewman.net/articles/2006/09/04/new-rails-feature-simply_helpful">Simply Helpful</a>

View file

@ -1,10 +1,3 @@
Title: Dumping Objects to the Browser in Rails
Date: May 15, 2007
Timestamp: 1179261480
Author: sjs
Tags: rails
----
Here's an easy way to solve a problem that may have nagged you as it did me. Simply using <code>foo.inspect</code> to dump out some object to the browser dumps one long string which is barely useful except for short strings and the like. The ideal output is already available using the <a href="http://www.ruby-doc.org/stdlib/libdoc/prettyprint/rdoc/index.html"><code>PrettyPrint</code></a> module so we just need to use it.

View file

@ -1,10 +1,3 @@
Title: Cheating at Life in General
Date: May 16, 2007
Timestamp: 1179308760
Author: sjs
Tags: cheat, vim, emacs, textmate
----
*NB: My definition of life is slightly skewed by my being somewhat of a geek*
Luckily no one in the real world cares if you cheat. Most of life is open-book, but for the times when you just need to find something quick the answer, of course, is to [cheat](http://cheat.errtheblog.com/) profusely.

View file

@ -1,10 +1,3 @@
Title: iPhone Humour
Date: May 18, 2007
Timestamp: 1179513240
Author: sjs
Tags: apple, funny, iphone
----
Love it or hate it - even though it's not even out yet - the iPhone has spawned at least 2 good jokes.
[The other iPhone lawsuit](http://www.geekculture.com/joyoftech/joyarchives/910.html) (GeekCulture.com)

View file

@ -1,10 +1,3 @@
Title: Inspirado
Date: May 22, 2007
Timestamp: 1179865380
Author: sjs
Tags: rails, inspirado
----
<a href="http://spyderous.livejournal.com/">spyderous</a> is a Gentoo dev and I read his posts via the <a href="http://planet.gentoo.org/">Gentoo planet</a> (and again on the <a href="http://planet.freedesktop.org/">freedesktop.org planet</a>).
He recently mentioned <a href="http://spyderous.livejournal.com/88463.html">an idea</a> to foster participation in Gentoo (or any other project) by aggregating personal project plans for people to browse. I thought it sounded cool so I started coding and came up with what I call <a href="http://http://rubyforge.org/projects/inspirado/">inspirado</a>.

View file

@ -1,8 +1 @@
Title: Finnish court rules CSS ineffective at protecting DVDs
Date: May 26, 2007
Timestamp: 1180175040
Author: sjs
Tags: drm
----
It's nice to see people making sane calls on issues like this. <a href="http://arstechnica.com/index.ars">Ars</a> has a nice <a href="http://arstechnica.com/news.ars/post/20070525-finland-court-breaking-ineffective-copy-protection-is-permissible.html">summary</a> and there's also a <a href="http://www.turre.com/blog/?p=102">press release</a>.

View file

@ -1,8 +1 @@
Title: 301 moved permanently
Date: June 8, 2007
Timestamp: 1181350800
Author: sjs
Tags: life
----
Last weekend I moved out of the apartment I lived in for the last 3 1/2 years. Moving was a cinch thanks to a friend's garage, conveniently placed smack between my old place and the new one. Google maps tells me that I moved just under 3.4 km, which is 2.1 mi for the metric impaired, so it wasn't much of a move at all! My roommate and I live in the basement of a house split into 3 apartments. Our upstairs neighbours are friendly and seem pretty cool, except one lady upstairs seems a bit strange. It's a great place though and in the winter the wood stove fireplace is going to be awesome.

View file

@ -1,10 +1,3 @@
Title: so long typo (and thanks for all the timeouts)
Date: June 8, 2007
Timestamp: 1181350860
Author: sjs
Tags: mephisto, typo
----
Well for just over a year Typo ran the show. I thought I had worked out most of the kinks with Typo and Dreamhost but the latest problem I ran into was pretty major. I couldn't post new articles. If the stars aligned perfectly and I sacrificed baby animals and virgins, every now and then I could get it to work. Ok, all I really had to do was refresh several dozen times, waiting 1 minute for it to timeout every time, but it sucked nonetheless.
Recently I had looked at converting Typo to Mephisto and it seemed pretty painless. I installed Mephisto and followed whatever instructions I found via Google and it all just worked, with one caveat. The Typo converter for Mephisto only supports Typo's schema version 56, while my Typo schema was at version 61. Rather than migrate backwards I brought Mephisto's Typo converter up to date instead. If you're interested, <a href="/f/mephisto_converters-typo-schema_version_61.patch">download the patch</a>. The patch is relative to vendor/plugins, so patch accordingly.

View file

@ -1,10 +1,3 @@
Title: More Scheming with Haskell
Date: June 14, 2007
Timestamp: 1181783340
Author: sjs
Tags: coding, haskell, scheme
----
It's been a little while since I wrote about Haskell and the <a href="2007.05.03-a-scheme-parser-in-haskell-part-1">Scheme interpreter</a> I've been using to learn and play with both Haskell and Scheme. I finished the tutorial and got myself a working Scheme interpreter and indeed it has been fun to use it for trying out little things now and then. (Normally I would use Emacs or Dr. Scheme for that sort of thing.) There certainly are <a href="http://www.lshift.net/blog/2007/06/11/folds-and-continuation-passing-style">interesting things</a> to try floating around da intranet. And also things to read and learn from, such as <a href="http://cubiclemuses.com/cm/blog/tags/Misp">misp</a> (via <a href="http://moonbase.rydia.net/mental/blog/programming/misp-is-a-lisp">Moonbase</a>).
*I'm going to describe two new features of my Scheme in this post. The second one is more interesting and was more fun to implement (cond).*

View file

@ -1,10 +1,3 @@
Title: test/spec on rails declared awesome, just one catch
Date: June 14, 2007
Timestamp: 1181830860
Author: sjs
Tags: bdd, rails, test/spec
----
This last week I've been getting to know <a href="http://chneukirchen.org/blog/archive/2007/01/announcing-test-spec-0-3-a-bdd-interface-for-test-unit.html">test/spec</a> via <a href="http://errtheblog.com/">err's</a> <a href="http://require.errtheblog.com/plugins/wiki/TestSpecRails">test/spec on rails</a> plugin. I have to say that I really dig this method of testing my code and I look forward to trying out some actual <a href="http://behaviour-driven.org/">BDD</a> in the future.
I did hit a little snag with functional testing though. The method of declaring which controller to use takes the form:

View file

@ -1,10 +1,3 @@
Title: Begging the question
Date: June 15, 2007
Timestamp: 1181933340
Author: sjs
Tags: english, life, pedantry
----
I'm currently reading <a href="http://mitpress.mit.edu/sicp/full-text/book/book.html">SICP</a> since it's highly recommended by many people, available for free, and interesting. The fact that I have a little <a href="2007.06.14-more-scheming-with-haskell">Scheme interpreter</a> to play with makes it much more fun since I can add missing functionality to it as I progress through the book, thereby learning more Haskell in the process. Yay!
Anyway I was very pleased to see the only correct usage of the phrase "begs the question" I have seen in a while. It's a pet peeve of mine, but I have submitted myself to the fact that the phrase is so oft used to mean "begs for the following question to be asked..." that it may as well be re-defined. In its correct usage the sentence seems to hang there if you try to apply the commonly mistaken meaning to it. That's all very hazy so here's the usage in SICP (emphasis my own):

View file

@ -1,10 +1,3 @@
Title: Back on Gentoo, trying new things
Date: June 18, 2007
Timestamp: 1182215100
Author: sjs
Tags: emacs, gentoo, linux, vim
----
I started using my Gentoo box for development again and there are a few things about Linux I didn't realize I had been missing.
### Shell completion is awesome out of the box ###

View file

@ -1,10 +1,3 @@
Title: Reinventing the wheel
Date: June 20, 2007
Timestamp: 1182356820
Author: sjs
Tags: emacs, snippets
----
Emacs is very impressive. I only felt lost and unproductive for minutes and now it seems natural to use and get around in. I've got <a href="2007.06.14-more-scheming-with-haskell">ElSchemo</a> set as the default scheme, and running inferior processes interactively is an absolute dream. My scheme doesn't have readline support (which bothers me to the point where I've thought about adding it just so I can use the thing) but when running it under Emacs there's absoutely no need for anything like that since I have the power of my editor when interacting with any program.
There has been a considerable amount of work done to aide in Rails development which makes Emacs especially comfortable for me. I now know why people have Emacs windows maximized on their screens. Because of its age Emacs is a handy window manager that basically eliminates the need for anything like <a href="http://en.wikipedia.org/wiki/GNU_Screen">GNU screen</a> or a window manager such as <a href="http://www.nongnu.org/ratpoison/">Rat poison</a> (which is great if you like screen), just maximize that Emacs "frame" or open one for each display and get to it. If you need a shell you just split the window and run your shell, when you're done you can easily switch back to your editing and your shell will wait in the background until you need it again. With rails-mode on I can run script/console (or switch back to it) with <code>C-c C-c s c</code>. My zsh alias for script/console is <code>sc</code> and I have other similarly succint ones for other stuff, so I took right to the shortcuts for all the handy things that I no longer have to switch applications to do:

View file

@ -1,10 +1,3 @@
Title: Embrace the database
Date: June 22, 2007
Timestamp: 1182507240
Author: sjs
Tags: activerecord, rails, ruby
----
If you drink the Rails koolaid you may have read the notorious <a href="http://www.loudthinking.com/arc/2005_09.html">single layer of cleverness</a> post by <a href="http://www.loudthinking.com/">DHH</a>. <em>[5th post on the archive page]</em> In a nutshell he states that it's better to have a single point of cleverness when it comes to business logic. The reasons for this include staying agile, staying in Ruby all the time, and being able to switch the back-end DB at any time. Put the logic in ActiveRecord and use the DB as a dumb data store, that is the Rails way. It's simple. It works. You don't need to be a DBA to be a Rails developer.
<a href="http://www.stephenbartholomew.co.uk/">Stephen</a> created a Rails plugin called <a href="http://www.stephenbartholomew.co.uk/2007/6/22/dependent-raise">dependent-raise</a> which imitates a foreign key constraint inside of Rails. I want to try this out because I believe that data integrity is fairly important, but it's really starting to make me think about this single point of cleverness idea.

View file

@ -1,10 +1,3 @@
Title: Emacs for TextMate junkies
Date: June 23, 2007
Timestamp: 1182565020
Author: sjs
Tags: emacs, textmate
----
*Update #1: What I first posted will take out your < key by mistake (it's available via `C-q <`), it has since been revised to Do The Right Thing.*
*Update #2: Thanks to an anonymouse[sic] commenter this code is a little cleaner.*

View file

@ -1,10 +1,3 @@
Title: Floating point in ElSchemo
Date: June 24, 2007
Timestamp: 1182711180
Author: sjs
Tags: elschemo, haskell, scheme
----
### Parsing floating point numbers ###
The first task is extending the <code>LispVal</code> type to grok floats.

View file

@ -1,10 +1,3 @@
Title: Emacs: tagify-region-or-insert-tag
Date: June 25, 2007
Timestamp: 1182809580
Author: sjs
Tags: emacs, tagify
----
After <a href="2007.06.26-rtfm">axing</a> half of <a href="2007.06.23-emacs-for-textmate-junkies">wrap-region.el</a> I renamed it to <a href="/f/tagify.el">tagify.el</a> and improved it ever so slightly. It's leaner, and does more!
<code>tagify-region-or-insert-tag</code> does the same thing as <code>wrap-region-with-tag</code> except if there is no region it now inserts the opening and closing tags and sets point in between them. I have this bound to <code>C-z t</code>, as I use <code>C-z</code> as my personal command prefix.

View file

@ -1,10 +1,3 @@
Title: Propaganda makes me sick
Date: June 25, 2007
Timestamp: 1182768900
Author: sjs
Tags: propaganda
----
Things <a href="http://arstechnica.com/news.ars/post/20070625-spying-on-campus-fbi-warns-mit-harvard.html">like this</a> in modern times are surprising. Can't people spot this phony crap for what it is?
<tt>First they put away the dealers, keep our kids safe and off the streets<br>

View file

@ -1,10 +1,3 @@
Title: RTFM!
Date: June 26, 2007
Timestamp: 1182806340
Author: sjs
Tags: emacs, rtfm
----
I should read the Emacs manual sometime, especially since I have it in dead-tree form. Check out <a href="http://www.gnu.org/software/emacs/manual/html_node/autotype/Inserting-Pairs.html">skeleton pairs</a> in the Emacs manual, or better yet <code>C-h f skeleton-pair-insert-maybe</code>. skeleton-pair has already been massaged to do what you most likely want if you set the correct options. Cool. I like Emacs more every day.
This renders <a href="2007.06.23-emacs-for-textmate-junkies">wrap-region</a> useless, which is great! I like a trim .emacs and .emacs.d.

View file

@ -1,10 +1,3 @@
Title: Recent Ruby and Rails Regales
Date: June 28, 2007
Timestamp: 1183058580
Author: sjs
Tags: rails, rails on rules, regular expressions, ruby, sake, secure associations, regex
----
Some cool Ruby and [the former on] Rails things are springing up and I haven't written much about the two Rs lately, though I work with them daily.
### Rails on Rules ###

View file

@ -1,10 +1,3 @@
Title: Controlling volume via the keyboard on Linux
Date: June 30, 2007
Timestamp: 1183245180
Author: sjs
Tags: alsa, linux, ruby, volume
----
I was using Amarok's global keyboard shortcuts to control the volume of my music via the <a href="http://pfuca-store.stores.yahoo.net/haphackeylit1.html">keyboard</a> but I wanted to control the system volume as well. A quick script later and now I can control both, and thanks to libnotify I get some feedback on what happened. It's not as pretty as OS X's volume control or <a href="http://growl.info/">Growl</a> but it'll certainly do.
<a href="/f/volume.rb">&darr; Download volume.rb</a>

View file

@ -1,10 +1,3 @@
Title: A TextMate tip for Emacs users
Date: July 3, 2007
Timestamp: 1183481100
Author: sjs
Tags: emacs, keyboard shortcuts, textmate
----
*Update: The only place I've seen this mentioned is in a <a href="http://macromates.com/blog/2005/screencast/#comment-660">comment</a> on the MacroMates blog.*
My Linux box is down due to a hardware failure; a cheap SATA controller to be specific. Perhaps that will be a story for another day. As a result I've been working on my MacBook and back in TextMate. Old habits. And I haven't gotten comfortable in any of the OS X Emacsen yet.

View file

@ -1,8 +1 @@
Title: RushCheck: QuickCheck for Ruby
Date: July 5, 2007
Timestamp: 1183665000
Author: sjs
Tags: quickcheck, ruby, rushcheck
----
I cannot wait to try out <a href="http://rushcheck.rubyforge.org/about.html">RushCheck</a>. It is <a href="http://www.cs.chalmers.se/~rjmh/QuickCheck/">QuickCheck</a> for Ruby. I don't have experience with QuickCheck or anything but it's clear to see how this helps you make certain your code is robust.

View file

@ -1,10 +1,3 @@
Title: See your regular expressions in Emacs
Date: July 6, 2007
Timestamp: 1183740300
Author: sjs
Tags: emacs, regex
----
First, if you are an Emacs newbie then be sure to read (at least) the introduction of <a href="http://stuff.mit.edu/iap/emacs">Being Productive with Emacs</a>. For some reason the PDF and HTML versions are slightly similar.
Anyway, it mentions <code>re-builder</code> which is an awesome little gem if you use regular expressions at all<sup>1</sup>. What this baby does is open a small window at the bottom of your screen in which you can type a regex. It is parsed as you type it and matches are highlighted in the other window. Genius.

View file

@ -1,10 +1,3 @@
Title: people
Date: July 12, 2007
Timestamp: 1184243280
Author: sjs
Tags: life, people
----
Sometimes this is difficult to remember for someone who (likes to think that he) thinks somewhat logically.
> When dealing with people, let us remember that we are not dealing with creatures of logic. We are dealing with creatures of emotion, creatures bristling with prejudices and motivated by pride and vanity.

View file

@ -1,10 +1,3 @@
Title: ElSchemo: Boolean logic and branching
Date: August 2, 2007
Timestamp: 1186073940
Author: sjs
Tags: elschemo, haskell, scheme
----
I've been developing a Scheme
interpreter in Haskell called
<a href="2007.06.24-floating-point-in-elschemo">ElSchemo</a>.

View file

@ -1,10 +1,3 @@
Title: Cheat from Emacs
Date: August 9, 2007
Timestamp: 1186710960
Author: sjs
Tags: Emacs
----
*Update: I had inadvertently used <code>string-join</code>, a function provided by something in my ~/.emacs.d. The script has been updated to work with a vanilla Emacs (23, but should work with 22 as well).*
*Update #2 [2007.08.10]: Editing cheats and diffs have been implemented.*

View file

@ -1,10 +1,3 @@
Title: Snap, crunchle, pop
Date: August 9, 2007
Timestamp: 1186654620
Author: sjs
Tags: humans, injury, life
----
I think that every now and then we need to be reminded of the frail nature of our human bodies. Yesterday morning as I walked to my kitchen I was turning right by pivoting on my right foot when my 24 years of walking experience suddenly failed me. I clearly did something wrong, as I heard a crunching pop or two in my right ankle and went down. Luckily it's just a sprain but my foot is fairly bruised and still sore today. I'm trying to follow the <a href="http://orthopedics.about.com/cs/sprainsstrains/a/sprain_4.htm">RICE</a> method for recuperating but one can only lay down for so long before having to eat, work, use the bathroom, etc. Thank goodness I don't work on my feet or I'd be out of commission. If it still hurts next week I'm going to see a doctor but till then I'm trying not to leave my house. The idea of hopping and hobbling to a bus to go to a doctor does not thrill me in the slightest.
Oh, if you find yourself in a bind an upside down hockey stick is a decent makeshift crutch. You'll need 2 hands to operate the thing though.

View file

@ -1,10 +1,3 @@
Title: Opera is pretty slick
Date: August 11, 2007
Timestamp: 1186834260
Author: sjs
Tags: browsers, firefox, opera
----
Though I usually prefer free software, I don't have any problems using proprietary stuff if I think it's good. I had Firefox open for a couple of days and noticed that it was using 700M of memory. That's not a problem at all since I have 4G but it's also a lot of RAM to be in use for just one window with one tab open. The fact that Firefox gets sluggish after some time and needs to be restarted tells me that this isn't expected behaviour and is likely not due to caching for quick back/forward or whatever they claim is taking up the leaked memory.
Konqueror is ok but I'm not a huge fan of it, partly due to its kitchen-sink browser/file manager hybrid design. IMO the KDE folks should break out the file manager part, but I digress. I can't really put my finger on anything specific I dislike about Konqueror, it's just not for me. To my dismay it seems to be the snappiest browser on Linux.

View file

@ -1,10 +1,3 @@
Title: Catch compiler errors at runtime
Date: August 19, 2007
Timestamp: 1187561820
Author: sjs
Tags: ruby
----
While coding just now I had a small epiphany about Ruby. Though Ruby is highly dynamic and compiled at runtime, that doesn't preclude one catching some mistakes at compile time. I'm not talking about mere syntax errors or anything either. The only proviso to catching mistakes at compile time is that you must have a decent chunk of code executed during compilation. One benefit of Ruby's blurring of compile time and runtime is that you can run real code at compile time. This is largely how metaprogramming tricks are pulled off elegantly and with ease in projects such as Rails.
Sure you won't get all the benefits of a strictly and/or statically typed compiler, but you can get some of them. If you have a library that makes substantial use of executing code at compile time then the mere act of loading your library causes your code to run, thus it compiles. If you <code>require</code> your lib and get <code>true</code> back then you know the code that bootstraps the runtime code is at least partially correct.

View file

@ -1,10 +1,3 @@
Title: Cheat productively in Emacs
Date: August 21, 2007
Timestamp: 1187720400
Author: sjs
Tags: Emacs
----
By now you may have heard about <a href="http://cheat.errtheblog.com/">cheat</a>, the command line cheat sheet collection that's completely open to editing, wiki style. A couple of weeks ago I posted <a href="2007.08.10-cheat-from-emacs">cheat.el</a> which allows one to cheat from within Emacs. There's an update. However, before I get to cheat.el there's a small detour.
Cheat is not just about Ruby! A few examples of cheats available are:

View file

@ -1,8 +1 @@
Title: Captivating little creatures
Date: August 26, 2007
Timestamp: 1188131700
Author: sjs
Tags: games, lemmings
----
Someone posted this JavaScript implementation of an old gem on Reddit, <a href="http://www.elizium.nu/scripts/lemmings/">Lemmings</a>! There goes my Sunday! :)

View file

@ -1,10 +1,3 @@
Title: 5 ways to avoid looking like a jerk on the Internet
Date: August 30, 2007
Timestamp: 1188487500
Author: sjs
Tags: life, netiquette
----
Let me begin by stating that these are tips I have gathered by posting in many public forums on the Internet and I have learned most of these rules by making the mistakes myself. I'm not trying to point fingers at anyone or act all holier-than-thou. It's a cold, emotionless medium text is. It can be difficult to accurately convey one's feelings when typing a quick reply somewhere. <a href="http://www.penny-arcade.com/comic/2004/03/19">John Gabriel's theory</a> certainly plays a part as well, but I'll try and assume that you are generally a nice person. I also assume that we are talking about a text medium (IRC, forums, Slashdot/Reddit/Digg). None of that fancy voice or video conferencing stuff!
Also, this is not a guide on how to really be an arrogant prick, but just not look like one when you engage in conversations on the Internet. It's also not a guide on not being a jerk. Should you lack basic manners you will have to learn them elsewhere.

View file

@ -1,8 +1 @@
Title: Learning Lisp? Read PCL
Date: September 25, 2007
Timestamp: 1190714340
Author: sjs
Tags: lisp
----
Yes, it's a book. But it's so well written you should breeze through it as if it were a <a href="http://www.gigamonkeys.com/book/">Lisp tutorial</a>!

View file

@ -1,10 +1,3 @@
Title: Python and Ruby brain dump
Date: September 26, 2007
Timestamp: 1190802840
Author: sjs
Tags: python, ruby
----
It turns out that <a href="http://dev.laptop.org/git?p=security;a=blob;f=bitfrost.txt">Python is the language of choice on the OLPC</a>, both for implementing applications and exposing to the users. There is a view source key available. I think Python is a great choice.
I've been using Ruby almost exclusively for over a year but the last week I've been doing a personal project in Python using <a href="https://storm.canonical.com/">Storm</a> (which is pretty nice btw) and <a href="http://excess.org/urwid/">urwid</a>. I'm remembering why I liked Python when I first learned it a few years ago. It may not be as elegant as Ruby, conceptually, but it sure is fun to code in. It really is executable pseudo-code for the most part.

View file

@ -1,10 +1,3 @@
Title: Gtkpod in Gutsy Got You Groaning?
Date: October 29, 2007
Timestamp: 1193692440
Author: sjs
Tags: broken, gtkpod, linux, ubuntu
----
I recently upgraded the <a href="http://www.ubuntu.com/">Ubuntu</a> installation on my workstation from Feisty Fawn to Gutsy Gibbon and for the most part I am happy with the changes. One thing I don't care much for is the fact that gtkpod-aac is a sham. Ubuntu provides the gtkpod-aac package for one to transfer aac files, and thus mp4 files with aac audio tracks, to their iPod. The version in the Gutsy repos is broken. This shows a weakness in Ubuntu, and though it's rather small it is one that will piss off a lot of people who expect things to just work. The kind of people who would buy an iPod. The kind of people who use Linux. The kind of Linux users that use Ubuntu. The kicker is that <a href="https://bugs.launchpad.net/ubuntu/+source/gtkpod-aac/+bug/135178/comments/6">it doesn't look like</a> they will ship a working version of gtkpod-aac for Gutsy at all. I know it's only 6 months but that seems like an eternity when you have the same old crap to watch on your iPod for that long.
All is not lost. A kind soul left <a href="https://bugs.launchpad.net/ubuntu/+source/gtkpod-aac/+bug/135178/comments/7">a helpful comment</a> on the <a href="https://bugs.launchpad.net/ubuntu/+source/gtkpod-aac/+bug/135178">bug report</a> explaining how he got it to work. It's a pretty simple fix. Just <a href="http://www.google.ca/search?q=libmpeg4ip">google for libmpeg4ip</a> and find a <a href="http://ftp.uni-kl.de/debian-multimedia/pool/main/libm/libmpeg4ip/">Debian repo that has the following packages</a> for your architecture:

View file

@ -1,10 +1,3 @@
Title: Random pet peeve of the day
Date: January 7, 2008
Timestamp: 1199727720
Author: sjs
Tags: usability, web
----
So long since my last post, and all I'm going to do is complain. ;-) Seriously though, if you have a website and the content on said site is dated then please for the love of our almighty saviour, the <a href="http://www.venganza.org/about">Flying Spaghetti Monster</a> <em>put the date at the <strong>top</strong> of the page</em>. Don't make me scroll down to the end of the article just to see how relevant it is or just to give me some context. Not to mention that I always end up doing a "Where <em>is</em> the end? Oh crap, I passed it and now I'm in the comments, blargh!"
I'm looking at Lifehacker since they're the most recent offender I've come across, but they are definitely not the only ones guilty of this.

View file

@ -1,10 +1,3 @@
Title: Thoughts on Arc
Date: February 19, 2008
Timestamp: 1203420360
Author: sjs
Tags: lisp arc
----
*NB: This is just a braindump. There's nothing profound or particularly insightful in this post.*
You may have heard that <a href="http://www.paulgraham.com/">Paul Graham</a> recently released his pet dialect of Lisp: <a href="http://arclanguage.org/">Arc</a>. It's a relatively small language consisting of just 4500 lines of code. In just under <a href="http://arclanguage.com/install">1200 lines</a> of <a href="http://www.plt-scheme.org/">PLT Scheme</a> the core of Arc is defined. The rest of the language is written in Arc itself. The heart of that is a file arc.arc, weighing in at 1500 lines. The remaining 1000-1300 lines are spread between libraries, mainly for writing web apps: html.arc, srv.arc, app.arc, and a few others.

View file

@ -1,10 +1,3 @@
Title: Project Euler code repo in Arc
Date: March 3, 2008
Timestamp: 1204561440
Author: sjs
Tags: arc, project euler
----
Release early and often. This is a code repo web app for solutions to <a href="http://projecteuler.net/">Project Euler</a> problems. You can only see your own solutions so it's not that exciting yet (but it scratches my itch... once it highlights syntax). You can <a href="http://nofxwiki.net:3141/euler">try it out</a> or <a href="http://samhuri.net/euler.tgz">download the source</a>. You'll need an up-to-date copy of <a href="http://arcfn.com/2008/02/git-and-anarki-arc-repository-brief.html">Anarki</a> to untar the source in. Just run <strong>arc.sh</strong> then enter this at the REPL:

View file

@ -1,10 +1,3 @@
Title: Using Emacs to Develop Mojo Apps for WebOS
Date: November 21, 2009
Timestamp: 1258790400
Author: sjs
Tags: emacs, mojo, webos, lisp, javascript
----
The latest technology I've been learning is Palm's SDK for webOS,
Mojo. My first impression is that it's a great platform and
Palm could do a great job of 2.0 if they cut down on some of the

View file

@ -1,10 +1,3 @@
Title: Working with C-style structs in Ruby
Date: January 17, 2010
Timestamp: 1263715200
Author: sjs
Tags: ruby, cstruct, compiler
----
<p>This is the beginning of a series on generating Mach-O object files in
Ruby. We start small by introducing some Ruby tools that are useful when
working with binary data. Subsequent articles will cover a subset of the

View file

@ -1,10 +1,3 @@
Title: Basics of the Mach-O file format
Date: January 18, 2010
Timestamp: 1263801600
Author: sjs
Tags: mach-o, os x, compiler
----
<p><i>This post is part of a series on generating basic x86 Mach-O files
with Ruby. The
<a href="2010.01.17-working-with-c-style-structs-in-ruby">

View file

@ -1,10 +1,3 @@
Title: A preview of Mach-O file generation
Date: January 20, 2010
Timestamp: 1263974400
Author: sjs
Tags: ruby, mach-o, os x, compiler
----
<p>This month I got back into an x86 compiler I started last May. It lives <a
href="https://github.com/samsonjs/compiler">on github</a>.</p>

View file

@ -1,10 +1,3 @@
Title: 37signals' Chalk Dissected
Date: November 4, 2010
Timestamp: 1288854000
Author: sjs
Tags: 37signals, chalk, ipad, javascript, web, html, css, zepto.js
----
<p><i>Update 2010-11-05: I dove into the JavaScript a little and explained most of it. Sam Stephenson <a href="https://twitter.com/sstephenson/status/553490682216449">tweeted</a> that Chalk is written in <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a> and compiled on the fly when served using <a href="https://github.com/sstephenson/brochure">Brochure</a>. That's hot! (for those unaware Sam Stephenson works at 37signals, and is also the man behind <a href="http://www.prototypejs.org/">Prototype</a>.)</i></p>
<p><a href="http://37signals.com/">37signals</a> recently released a blackboard web app for iPad called <a href="http://chalk.37signals.com/">Chalk</a>.</p>

View file

@ -1,6 +1 @@
Title: Lights
Date: November 27, 2011
Timestamp: 1322446260
Link: http://lights.elliegoulding.com/
----
An interactive WebGL visualization. Where's the LSD when you need it?

View file

@ -1,9 +1,2 @@
Title: Recovering Old Blog Posts
Date: November 27, 2011
Timestamp: 1322385300
Author: sjs
Tags: recover, old, blog, posts
----
I'm in the process of recovering some old blog posts from the [Wayback Machine](http://web.archive.org).
Some of them might be culled, because nobody cares about my old blog posts except for me.

View file

@ -1,10 +1,3 @@
Title: A Static URL Shortener Using .htaccess
Date: December 10, 2011
Timestamp: 1323584949
Author: sjs
Tags: s42.ca, url, shortener, samhuri.net, url shortener
----
This blog is statically generated. A few Ruby and Node.js scripts along with a Makefile and some duct tape hold it all together. All of [samhuri.net is on Github][GH] if you want to take a look. Most of it is quite minimal, sometimes to a fault. Little improvements are made here and there and the most recent one is neat [.htaccess][htaccess-wiki] hack. I want to automatically announce new posts on Twitter so short URLs are in order.
I try to strike a reasonable balance between writing everything for this site myself and using libraries. A quick look at a few short URL projects was enough to see they weren't what I was looking for. They were all database backed servers. Comments on this blog are served up dynamically but everything else is static and I try to avoid dynamic behaviour when possible. Comments are moving to a more static system sometime. Anyway I registered the domain [s42.ca][s42] and nabbed [an algorithm for creating the short codes from Jonathan Snook][snook] before diving into TextMate to implement my idea.

View file

@ -1,9 +1,3 @@
Title: Pure CSS3 images? Hmm, maybe later
Date: December 11, 2011
Timestamp: 1323635103
Link: http://calendar.perfplanet.com/2011/pure-css3-images-hmm-maybe-later/
----
Great analysis of the performance of CSS based images. Not directly
mentioned, but very apparent, is that the task of making CSS images itself
is prohibitively difficult.

View file

@ -1,8 +1,2 @@
Title: I see HTTP
Date: December 15, 2011
Timestamp: 1323964035
Link: http://calendar.perfplanet.com/2011/i-see-http/
----
Icy is a public domain iOS app that lets you see everything a web page
loads in great detail. This looks useful.

View file

@ -1,10 +1,3 @@
Title: My kind of feature checklist
Date: December 19, 2011
Timestamp: 1324354805
Link: http://www.marco.org/2011/12/19/amazon-kindle-vs-ipad
Comments: off
----
Marco's feature checklist in favour of the iPad illustrates how easy it is
to rig these things. Combined with Amazon's checklist favouring the Kindle
Fire this would be mildly useful, half as long as a modest review, and with

View file

@ -1,10 +1,3 @@
Title: New Release of Firefox for Android, Optimized for Tablets
Date: December 22, 2011
Timestamp: 1324868051
Link: http://daringfireball.net/linked/2011/12/22/firefox-android
Comments: off
----
> On the other hand, watch this video. Even in Mozilla's own demo - which presumably puts Firefox for Android in its best light - doesn't the whole thing look a bit herky-jerky, in terms of touch responsiveness and scrolling smoothness?
Surely they could do better on iOS though. I have faith in the Firefox

View file

@ -1,10 +1,3 @@
Title: The Broken Pixel Theory
Date: December 25, 2011
Timestamp: 1324868060
Link: http://jtaby.com/2011/12/25/the-broken-pixel-theory.html
Comments: off
----
> For example, a clean desk tends to stay clean until a piece of paper stays on it for a couple of days. Similarly, I=92m much less likely to care about a 2-3 pixel UI bug when the whole UI is a mess.
Great insight from Majd Taby.

View file

@ -1,8 +1 @@
Title: Yak shaving
Date: January 4, 2012
Timestamp: 1325712240
Link: http://blog.hasmanythrough.com/2012/1/4/yak-shaving
Comments: off
----
The best plain-english explanation of yak shaving I have seen.

View file

@ -1,10 +1,3 @@
Title: The $40 Standup Desk
Date: January 9, 2012
Timestamp: 1326097000
Link: http://opensoul.org/blog/archives/2012/01/09/the-40-standup-desk/
Comments: off
----
> Ultimately, I decided I might as well just do something cheap for now. So I built my own. I had thinking about doing it for a while when my coworker Steve Smith built his desk. After seeing his, I was convinced this was what I wanted to do. It turns out, the cheap option is pretty awesome.
This looks great. Might have to consider it when or if I get a desk.

Some files were not shown because too many files have changed in this diff Show more