- 1
- 2
- 3
- 4
- 5
- 6
- 7
// http://msdn.microsoft.com/en-us/library/dya2szfk%28v=VS.71%29.aspx
If x = True Then ' Compares x to the Boolean value True.
' Insert code to execute if x = True.
Else
' Insert code to execute if x = False.
End If
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+136
// http://msdn.microsoft.com/en-us/library/dya2szfk%28v=VS.71%29.aspx
If x = True Then ' Compares x to the Boolean value True.
' Insert code to execute if x = True.
Else
' Insert code to execute if x = False.
End If
http://msdn.microsoft.com/en-us/library/dya2szfk%28v=VS.71%29.aspx
Учебник по языку, да
+63
function projects_action($action)
{
switch ($action) {
case '1': return 'Создал проект'; break;
case '2': return 'Изменил название'; break;
case '3': return 'Изменил бюджет'; break;
case '4': return 'Изменил дату добавления'; break;
case '5': return 'Изменил дату окончания'; break;
case '6': return 'Изменил приоритет'; break;
case '7': return 'Изменил язык'; break;
case '8': return 'Сменил клиента'; break
# …
case '32': return 'Изменил схему'; break;
default: return;
}
}
+141
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
И опять регулярки, но уже на уровне гигантов...
http://framework.zend.com/manual/2.0/en/user-guide/routing-and-controllers.html
+157
var temp = new Date(),
diff = parseInt(($('#calrlimit1').data('datebox').theDate - temp) / ( 1000 * 60 * 60 * 24 ));
diffstrt = (diff * -1)-1; // If you want a minimum of 1 day between, make this -2 instead of -1
diffend = diff + 11; // Why 11 instead of 10? No idea...
Документация к плагину jQuery Mobile DateBox2
+125
sed -e 's/^/;;/g;s/$/ /g' -e :a -e '1!x;1h;s/.*\(.\)$/\1/;p;x;s/\(.*\).$/\1/;h;ta' ~/src/find_world.sh | sed -e :a -e 'N;s/\n//g;ba' | sed -e 's/;;/\n/g' -e 's/^[ ]*//g'
rev
+71
// *** Функция truncation - округление числа до сотых ***
// ******************************************************
function truncation($number)
{
global $n;
$n = strpos($number,'.');
if ($n > 0) {$n = substr($number,0,$n).substr($number,$n,3);} else {$n = $number;}
return;
}
Комментарии излишни
+134
private string GetNextDishCode()
{
string[] vesCode = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
for (int i = 0; i < vesCode.Length; i++)
if (!CheckDishes(vesCode[i]))
return vesCode[i];
return "AA";
}
В одном, довольно крупном и дорогом проекте.
+122
Уважаемые знатоки, вопрос такой:
sizeof('a') для С и Сpp имеет различное значение и это вам известно из
C99 Standard: 6.4.4.4 Character constants Para 2
и
C++03 Standard: 2.13.2 Character literals Para 1.
Интересует ваше предположение/мнение/версия/etc, для чего такое приняли?
Стандартоособенности и внезапнонесовместимости.
+67
if ($_GET['search'] == ' Поиск' || $_GET['search'] == 'Поиск') {
$_GET['search'] = '';
}
if ($_GET['date'] == ' Дата' || $_GET['date'] == 'Дата') {
$_GET['date'] = '';
} else {
$_GET['date'] = preg_replace('/(\d+).(\d+).(\d+)/i','$3-$2-$1', $_GET['date']);
}
Уж не знаю, что и сказать... А вдруг перед текстом попадутся 2 пробела? Или 3?
−92
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
self.view.frame=CGRectMake(10,10, 300, 200);
return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
cell.selectionStyle=UITableViewCellSelectionStyleNone;
switch (indexPath.row) {
case 0:
//ToDo: Add UserInfo's view into TableView
[cell.contentView addSubview:upperView];
break;
case 1:{
//Remove preous view/tableview
for (id vw in cell.contentView.subviews) {
if ([vw isKindOfClass:[UITableView class]]) {
[vw removeFromSuperview];
}
}
//
//Add View which contain tableview
EditListViewController *editlistvw=[[EditListViewController alloc] initWithNibName:@"EditListViewController" bundle:nil] ;
editlistvw.view.frame=CGRectMake(10, 10, 300, 20);
[cell.contentView addSubview:editlistvw.tableView];
//
break;
}
case 2:
//Remove previous view/tableview
for (id vw in cell.contentView.subviews) {
if ([vw isKindOfClass:[UITableView class]]) {
[vw removeFromSuperview];
}
}
break;
default:
break;
}
return cell;
}
Творение индийского джуниора, совместно с которым приходится делать проект