Back to front pageView on Hacker News (opens in a new tab)Ask HN: What is the most beautiful piece of code you've ever read?476 pointsby seisvelas (on Hacker News)7 years agoPreferably an elegant snippet rather than an entire (well engineered) codebase.Comments (380) 116 threadsShow all commentsShowing thread 80 of 116alex-ant7 years ago#Had a case where I needed to update MySQL column's value if an incoming argument is less/greater than it without using functions or procedures.This returns the greatest value (passed ? or max_value column): ?^((?^max_value)&-(? And for minimum: min_value^((?^min_value)&-(?
Ask HN: What is the most beautiful piece of code you've ever read?476 pointsby seisvelas (on Hacker News)7 years ago
alex-ant7 years ago#Had a case where I needed to update MySQL column's value if an incoming argument is less/greater than it without using functions or procedures.This returns the greatest value (passed ? or max_value column): ?^((?^max_value)&-(? And for minimum: min_value^((?^min_value)&-(?
Comments (380) 116 threads
Show all comments
Showing thread 80 of 116
This returns the greatest value (passed ? or max_value column):