- 1
- 2
- 3
long longVariable = <...>;
...
double doubleVariable = new Double(longVariable).doubleValue();
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+121
long longVariable = <...>;
...
double doubleVariable = new Double(longVariable).doubleValue();
Вот так делается по ВСЕМУ проекту, когда нужно перевести long в double.
+121
class Program
{
static int x = 0;
static int f()
{
x = x + 10;
return 1;
}
public static void Main()
{
x += f();
System.Console.WriteLine(x);
}
}
Следите за руками! Чему же в итоге равно x?
Проверить себя: http://ideone.com/v8rktM
Источник: http://blogs.msdn.com/b/oldnewthing/archive/2014/08/14/10549885.aspx
+121
Wct Editor forever
Ахаххахаха))
+121
//if they're locked out or banned die
if ( ( $bwpsoptions['id_enabled'] == 1 ||$bwpsoptions['ll_enabled'] == 1 ) && $this->checklock( $current_user->user_login ) ) {
wp_clear_auth_cookie();
@header( 'HTTP/1.0 418 I\'m a teapot' );
@header( 'Cache-Control: no-cache, must-revalidate' );
@header( 'Expires: Thu, 22 Jun 1978 00:28:00 GMT' );
die( __( 'error', $this->hook ) );
}
https://plugins.trac.wordpress.org/browser/better-wp-security/trunk/inc/secure.php#L925
+121
http://developerslife.ru/7879
// говнокодогенератор, он существует
+121
ref <- newIORef 0
replicateM_ 1000000 $ modifyIORef ref (+1)
readIORef ref >>= print
+121
if
(MatchPattern MatData Pattern:"MeshID *: *") and (
local Params = (FilterString (SubString MatData 8 -1) ":")
Params.Count == 2 and (
MatData = (TrimLeft (TrimRight Params[2]))
MID = (Params[1] as integer)
if
MID < 1 or
MID > 1000
then
InputOK = false
)
)
then (
...
)
MAXScript
Чумачечая валидация ввода информации о материале по несложному паттерну:
MeshID <Mesh material ID, a number from 1 to 1000>: <Material name>
...
Use LINQ, Luke!
+121
#include "commode.h"
//development might be long and harassing
//we'll need some furniture to keep food and coffee
+121
Держу - верчу вот, в руках сидюк. На обложке надпись: "Программирование для школькиков и студентов".
Вроде бы пустяк, но с недавних пор эта фраза для меня звучит весьма кощунственно.
+121
/// Разрезать строку на части длиной не более maxRecordLen
private static void splitText(ref List<string> splitTextArray, string text) {
splitTextArray = new List<string>();
for (; ; ) {
try {
string str = text.Substring(0, maxRecordLen);
splitTextArray.Add(str);
try {
text = text.Substring(maxRecordLen);
}
catch (Exception) {
break;
}
}
catch (Exception) {
splitTextArray.Add(text);
break;
}
}
}
no comment.