Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Korakot Chaovavanich http://korakot.stumbleupon.com

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

My snippet statistics and farewell

This is my 200th snippet, my last before a long journey.
I won't have a proper chance to be online for 9 months.
   1  
   2  # Stat of all my snippets since the beginning, April 2005
   3  
   4  python (176)
   5  series60 (96)
   6  pys60 (38)
   7  image (12)
   8  canvas (11)
   9  sql (10)
  10  html (9)
  11  database (9)
  12  color (8)
  13  text (8)
  14  time (7)
  15  sound (6)
  16  conversion (6)
  17  google (6)

P.S. Thank you, Peter. Sharing snippets here is really fun.
Bye!

Tag cloud using Text()


   1  
   2  from appuifw import *
   3  app.body = t = Text()
   4  
   5  fonts = [u'', u'LatinPlain12', u'LatinBold12', u'LatinBold13', u'LatinBold17', u'LatinBold19']
   6  tags = [(1, "apache"), (1, "array"), (1, "bash"), (1, "c"), (1, "cli"), (1, "csharp"), (1, "css"),
   7    (1, "database"), (1, "date"), (1, "expressionengine"), (1, "file"), (2, "html"), (1, "image"),
   8    (2, "java"), (4, "javascript"), (1, "lighttpd"), (1, "linux"), (1, "mac"), (1, "math"), (1, "mysql"),
   9    (1, "osx"), (1, "perl"), (3, "php"), (1, "pys60"), (5, "python"), (4, "rails"), (1, "regex"),
  10   (4, "ruby"), (1, "rubyonrails"), (1, "series"), (3, "series60"), (1, "servers"), (2, "shell"), (2, "sql"),
  11   (1, "ssh"), (1, "string"), (1, "text"), (1, "time"), (1, "unix"), (1, "web"), (1, "windows"), (1, "xml"),]
  12  
  13  for level, tag in tags:
  14      t.font = fonts[level]
  15      t.add(tag + u' ')

See screenshot.

If using font is not enough, we can use other styles or colors.
See a related snippet.

Using multiple tags on Code Snippets

I spent a lot of time trying to select snippets with
contain multiple tags. (series60 and sql)
There is no '+' links I can click anymore.
After about 10 minutes of trial and error, I find out how.
This also answer another question on correct use of URL.
   1  
   2  # for tag 'series60' AND 'sql'
   3  http://www.bigbold.com/snippets/tags/series60/sql/
   4  
   5  # this doesn't work
   6  http://www.bigbold.com/snippets/tag/series60/sql/
   7  
   8  # all of these work (single tag case)
   9  http://bigbold.com/snippets/tag/series60/
  10  http://bigbold.com/snippets/tags/series60/
  11  http://www.bigbold.com/snippets/tag/series60/
  12  http://www.bigbold.com/snippets/tags/series60/

My conclusion is that.
For a single tag, use '/tag/...'.
For multiple tags, use '/tags/...'.
The first is quicker to type, while the second is flexible in case you want to filter further.
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS