- 1
- 2
- 3
- 4
int getRandomNumber(){
return 4; //chosen by fair dice roll.
//guaranteed to be random.
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+138
int getRandomNumber(){
return 4; //chosen by fair dice roll.
//guaranteed to be random.
}
−111
lv.onData = function(data:String):Void{
htmlData = data;
xml.parseXML(htmlData);
trace(xml.firstChild.lastChild.firstChild.lastChild.lastChild.lastChild.childNodes[1].childNodes[1].childNodes[0]);
trace(xml.firstChild.lastChild.firstChild.lastChild.lastChild.lastChild.childNodes[1].childNodes[2].childNodes[1].firstChild);
}
С демиарта.
+161
function timer() {
var t=new Date();
var sec=t.getSeconds();
var min=t.getMinutes();
var h=t.getHours();
var day=t.getDate();
var month=t.getMonth();
var year=t.getFullYear();
var d, y, m, allday, allhour, allmin, allsec;
if (year>2010) {
if (month===8) {
if (day===14) {
if (h===13) {
if (min<7) {y=year - 2011}
if (min>6) {y=year - 2010}
} else {
if (h<13) {y=year - 2011}
if (h>13) {y=year - 2010}
}
} else {
if (day<14) {y=year - 2011}
if (day>14) {y=year - 2010}
}
} else {
if (month<8) {y=year - 2011}
if (month>8) {y=year - 2010}
}
}
if (month===8) {
if (day===14) {
if (h===13) {
if (min===7) {
m=''
} else {
if (min<7) {m=month + 3}
if (min>7) {m=''}
}
} else {
if (h<13) {m=month + 3}
if (h>13) {m=''}
}
} else {
if (day<14) {m=month + 3}
if (day>14) {m=''}
}
} else {
if (month>-1 && month<8) {
if (day===14) {
if (h===13) {
if (min===7) {
m=month + 4
} else {
if (min<7) {m=month + 3}
if (min>7) {m=month + 4}
}
} else {
if (h<13) {m=month + 3}
if (h>13) {m=month + 4}
}
} else {
if (day<14) {m=month + 3}
if (day>14) {m=month + 4}
}
} else {
if (day===14) {
if (h===13) {
if (min===7) {
m=month - 8
} else {
if (min<7) {m=month - 9}
if (min>7) {m=month - 8}
}
} else {
if (h<13) {m=month - 9}
if (h>13) {m=month - 8}
}
} else {
if (day<14) {m=month - 9}
if (day>14) {m=month - 8}
}
}
}
if (day===14) {
if (h===13) {
if (min<7) {d=''}
if (min>6) {d=''}
} else {
if (h<13) {d=''}
if (h>13) {d=''}
}
}
if (day>14 && day<32) {
if (h===13) {
if (min<7) {d=day - 15}
if (min>6) {d=day - 14}
} else {
Счетчик к определённой дате, ну код естественно не весь) Писалось при изучении js почти 2 года назад)
−52
require_once '/usr/share/php/smarty/Smarty.class.php';
class SmartyMegaAPI extends Smarty{
public function __construct()
{
$this->Smarty();
$this->template_dir = './smarty/templates';
$this->config_dir = './smarty/config';
$this->compile_dir = './smarty/templates_c';
$this->cache_dir = './smarty/cache';
}
}
ООП такое ООП
+118
decimal retValue = <...>
var span = TimeSpan.FromMinutes(double.Parse(retValue.ToString()));
Почему бы просто не (double) retValue...
+112
int cutPosition = sb.ToString().IndexOf(" \r\n ");
Коммерческий проект :)
+71
@SuppressWarnings("deprecation")
static long startHourInMS() {
final Date date = new Date();
date.setMinutes(0);
date.setSeconds(0);
return date.getTime();
}
Where the Time Stood Still...
+141
if (value != null)
{
bool boolValue = (Boolean)value;
switch (boolValue)
{
case true:
return true;
case false:
return false;
}
}
Конвертер для CheckBox в WPF
+57
$format = $_[3]; # Format object
# Check for a format object
if (isset($_[3])) {
$ixfe = $format->get_xf_index();
} else {
$ixfe = 0x0F;
}
Сначала присвоить, а потом проверить наличие - это сильно!
Найдено в class.writeexcel_worksheet.inc.php - классе для заботы с .xls
+72
if (style == null || (style != null && !style.isEnabled())) {
throw new IllegalStateException();
}
if (style != null) {
do something . . .
}