Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
Parsing of XML data has high CPU usage
Convert simple Javascript to jQuery plugin
Active Record getting unique records
List the files in a directory without the directory name or the extension
clean the code
ohs system, recruitment software, hr software, oh&s software, human resources software, ohs software
Array parsing in a block
Learning JS
Type Safety
Euler Problem 2 solution
Popular
Parsing of XML data has high CPU usage
List the files in a directory without the directory name or the extension
Convert simple Javascript to jQuery plugin
Active Record getting unique records
Breadth first cartesian product iterator
php refactoring
first BST
Learning JS
Too many if statements
clean the code
Pastable version of
Classtemplate
<pre class='prettyprint' language='python'>#! /usr/bin/python """ A python primer. pydoc, doctest and classes. Syntax: To generate man pages: > pydoc classtemplate To try all the tests in doctest (and execute the script): > python classtemplate.py -v """ #Class definition class Table: """Class Table. Doctest: here we insert python command lines inputs and outputs. >>> print Table.database http://access.com/db """ #Data attributes here database='http://access.com/db' #Method attributes here def __init__(self,id,text): """Initializes the id and textlabel data attributes. Doctest: Testing more data attributes defined at construction time >>> x = Table(1,'coucou') >>> print x.id 1 >>> print x.textlabel coucou """ self.id=id self.textlabel=text #doctest -- "Debugging sucks :( Testing rocks :)" def _test(): """Inline Doctest activated. Cool! :D This means that whenever the module is called in python > python thismodule.py -v the doctest function will try all the tests implemented in doctest. """ import doctest doctest.testmod() if __name__ == "__main__": _test()</pre> <a href="http://www.refactormycode.com/codes/51-classtemplate" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>