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
Simple Particle Engine for a shooter game
Snake / Nibbles clone in C and Ncurses
Please improve
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
Popular
Parsing of XML data has high CPU usage
Please improve
Snake / Nibbles clone in C and Ncurses
List the files in a directory without the directory name or the extension
Convert simple Javascript to jQuery plugin
Simple Particle Engine for a shooter game
Active Record getting unique records
Breadth first cartesian product iterator
php refactoring
first BST
Pastable version of
Swedish Personnummer in Rails (Ruby)
<pre class='prettyprint' language='ruby'>def validate_ssn # Kontrollera antal siffror i personnummret. if ssn.size != 10 errors.add_to_base "Personnummret innehåller fel antal siffror. (ÅÅMMDDXXXX)" end # Räkna ut kontrollsiffran sum = tmp = 0 (0..8).each do |i| if i % 2 == 0 if (tmp = 2 * ssn[i,1].to_i) > 9 sum = sum + tmp - 9 else sum = sum + tmp end else sum = sum + ssn[i,1].to_i end end if (sum % 10) != 0 if (10 - (sum % 10)) != ssn[9,1].to_i errors.add_to_base 'Personnummret måste vara riktigt.' end else if ssn[9,1] != 0 errors.add_to_base 'Personnummret måste vara riktigt.' end end end</pre> <a href="http://www.refactormycode.com/codes/814-swedish-personnummer-in-rails-ruby" 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>