Skip to content

Instantly share code, notes, and snippets.

@anoras
Created December 14, 2010 22:39
Show Gist options
  • Save anoras/741250 to your computer and use it in GitHub Desktop.
Save anoras/741250 to your computer and use it in GitHub Desktop.
LOC kata
puts %q(
/*****
* This is a test program with 5 lines of code
* \/* no nesting allowed!
//*****//***/// Slightly pathological comment ending...
public class Hello {
public static final void main(String [] args) { // gotta love Java
// Say hello
System./*wait*/out./*for*/println/*it*/("Hello/*");
}
}
).gsub(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(\/\/.*)/,'').gsub(/^\s*$/,'').gsub(/\n+/,"\n").split(/\n/).length-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment