- 1
- 2
- 3
- 4
typedef typename _STD tr1::conditional<
_STD tr1::is_same<key_type, value_type>::value,
const_iterator,
_Tree_iterator<_Mybase> >::type iterator;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+32
typedef typename _STD tr1::conditional<
_STD tr1::is_same<key_type, value_type>::value,
const_iterator,
_Tree_iterator<_Mybase> >::type iterator;
Шаблоны на шаблонах и шаблонами погоняют.
+74
if (scope.equals("page")) {
beanObject = context.getAttribute(bean);
} else {
if (scope.equals("request")) {
beanObject = context.getRequest().getAttribute(bean);
} else {
if (scope.equals("session")) {
beanObject = context.getSession().getAttribute(bean);
} else {
if (scope.equals("context")) {
beanObject = context.getServletContext().getAttribute(bean);
}
}
}
}
+68
public function makeCategoryArray() {
$a = array();
for($i = 1; $i <=3 ; $i++) {
$j = $i != 1 ? $i : '';
$Method = "getCategoryid" . $j;
$categoryid = $this->$Method();
if($this->$Method()) {
try{
$category = BC::Get()->getCompanyService()->getCategoryByID($categoryid);
$a[] = array(
'name' => $category->getName(),
'url' => $category->makeURL()
);
} catch(Exception $e) {
return $a;
}
}
}
return $a;
}
Эпичный вызов getCategoryid1(), getCategoryid2(), getCategoryid3() когда есть getField(fieldname)...
+127
$ cat macro.c
# define M3(x, y, z) x + y + z
# define M2(x, y) M3(x, y)
# define P(x, y) {x, y}
# define M(x, y) M2(x, P(x, y))
M(a, b)
$ gcc-4.5 -E macro.c
# 1 "macro.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "macro.c"
a + {a + b}
$
Какой выхлоп по разным версиям cl?
Отсюда: http://stackoverflow.com/questions/11469462/difference-between-gcc-and-microsoft-preprocessor
−101
-(void)showRetrySuccess:(NSString*)requestUrlString
{
NSString *statusMessage = @"";
if([requestUrlString rangeOfString:kFollowFriendsRequest].location != NSNotFound)
{
statusMessage =@"Your follow friend request completed successfully.";
}
else
if([requestUrlString rangeOfString:kUnfollowFriendsRequest].location != NSNotFound)
{
statusMessage =@"Your unfollow friend request completed successfully.";
}else
if([requestUrlString rangeOfString:kDeleteContentService].location != NSNotFound)
{
statusMessage =@"Your delete request completed successfully.";
}else
if([requestUrlString rangeOfString:kSavePostService].location != NSNotFound)
{
statusMessage =@"Your save post request completed successfully";
}else
if([requestUrlString rangeOfString:kSaveMediaService].location != NSNotFound)
{
statusMessage =@"Your save request completed successfully";
}else
if([requestUrlString rangeOfString:kSaveTwitterDirectMessage].location != NSNotFound)
{
statusMessage =@"Your request completed successfully.";
}else
if([requestUrlString rangeOfString:kSaveTwitterResponse].location != NSNotFound)
{
statusMessage =@"Your request completed successfully.";
}
else
if([requestUrlString rangeOfString:kAddCommentService].location != NSNotFound)
{
statusMessage =@"Your post comment request completed successfully.";
}
UIAlertView * alert = [[[UIAlertView alloc] initWithTitle:@"" message:statusMessage delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]autorelease];
[alert show];
}
−63
<?php
global $KONKURS_ADMIN;
$KONKURS_ADMIN=array('[email protected]',
'[email protected]',
'[email protected]');
распределение привелегий в системе епта.
+134
for (int i = 0; i < e.Row.Cells.Count; i++)
{
....................................................
if ((i == 1) || (i == 4) || (i == 5) || (i == 6) || (i == 7) || (i == 8) || (i == 9) || (i == 10) || (i == 11) || (i == 12))//11 12
.............................................
Indian style..
no comments
−116
DECLARE @SysDatoFull datetime
SET @SysDatoFull = CAST(YEAR(getdate()) as varchar) + RIGHT('00'+CAST(MONTH(getdate()) as varchar), 2) + RIGHT('00'+CAST(DAY(getdate()) as varchar), 2)
SQL, даты... nuff said
Вспомнился http://govnokod.ru/9211. Может есть где-то специальное учебное заведение, где обучают таким техникам?
+70
if (s.startsWith("job."))
{
s = s.trim().replaceFirst("job\\.", "");
String name = s.split("\\.")[0];
String paramName = s.split("\\.")[1];
// Ещё немного говнокода, не сильно интересного
}
+68
public abstract class AbstractJob implements Job
{
private static ConcurrentHashMap<String, Boolean> mutexes = new ConcurrentHashMap<String, Boolean>();
public abstract void job(JobExecutionContext jec, Logger logger) throws JobExecutionException;
public void execute(JobExecutionContext jec) throws JobExecutionException
{
Logger logger = LoggerLocator.getLogger(this.getClass().getSimpleName());
if (mutexes.containsKey(this.getClass().getSimpleName()))
{
logger.info("Job "+jec.getJobDetail().getName()+" already running");
}
else
{
try
{
mutexes.put(this.getClass().getSimpleName(), true);
job(jec, logger);
}
finally
{
mutexes.remove(this.getClass().getSimpleName());
}
}
}
}
Race condition и передача логгера в параметрах очень порадовали. А ведь вместо написания кривого велосипеда можно было просто @DisallowConcurrentExecution