Yes! Syntax Highlighting for Mako in TextMate!
May 31, 2009 § 1 Comment
For the longest time I kept staring at ‘plain text mode’ while editing Mako templates. No Mas!
TextMate bundle for Mako template has existed.
To install:
-
cd ~/Library/Application\ Support/TextMate/Bundles/
-
svn co http://svn.makotemplates.org/contrib/textmate/Mako.tmbundle
After Reloading your bundle, syntax highlighting is available under HTML (Mako).
Reference:
HTML Quickie: Long String Overflowing Your Div
May 25, 2009 § 6 Comments
Do you have that problem? I do.
EDIT(05/31/2009): Even better solutions:
Hyphenator.js: http://code.google.com/p/hyphenator/
OR:
General CSS solution:
overflow: scroll
/EDIT
The HTML solution:
use <wbr>. (But you have to figure out yourself where to put the tag)
The IE-specific CSS solution:
word-wrap: break-word
PHP solution:
wordwrap(‘your_very_long_string_here’, 15) // Break after 15 characters
Python solution:
import textwrap
textwrap.fill(‘your_very_long_string_here’, 15) # Break after 15 characters
References:
The Male Programmer Privilege Checklist
May 25, 2009 § Leave a Comment
Original Article here: http://lafalafu.com/krc/privilege.html
The article is thoroughly descriptive and I didn’t even realize some of them until I read it.
Pylons Quickie: Mako Output
May 24, 2009 § Leave a Comment
By default Mako HTML escapes all output.
To NOT have this behavior, change the setting of TemplateLookup in environment.py.
Resources:
Pylons Quickie: I want to use distance_of_time_in_words
May 17, 2009 § Leave a Comment
distance_of_time_in_words is a useful function that converts boring looking datetime into something more attractive (and SEO optimized) like: 30 seconds ago.
Pylons gain this functionality via WebHelper which blatantly inspired by Rails.
But, out of the box, this functionality does not exists in my templates. To enable it, I need to add this line in helpers.py:
from webhelpers.date import distance_of_time_in_words
Resource:
Laconica: Open Source Twitter
May 16, 2009 § Leave a Comment
There are so many micro-blogging services nowadays. Sooner or later there will be an open source application for it.
And that application is called Laconica. It is written in PHP.
I haven’t try to install it yet, but it sounds fun.
Resource:
SqlAlchemy Quickie: How to use Distinct
May 15, 2009 § Leave a Comment
distinct() method is accessible from Query object. The documentation is kind of obscure, so hopefully this post is helpful for others.
Example:
@classmethod
def get_all_category(cls):
return meta.Session.query(cls.category).distinct().all()
Reference:
Ruby: A lot of 1 Liners
May 14, 2009 § Leave a Comment
Pylons Cheat Sheet
May 13, 2009 § Leave a Comment
Gender Guesser
May 13, 2009 § Leave a Comment
Fresh from Hacker News comments,
GenderGuesser is a simple webapp that analyze your essays and guess whether you are a man or a woman.