- 1
- 2
jQuery('.navbar .nav li').eq(1).addClass('dropdown').children('a').addClass('dropdown-toggle');
jQuery('.navbar .nav li').eq(2).append("<ul class='dropdown-menu unstyled'><li><a href='/production/xx/'>оборудование</a></li>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+149
jQuery('.navbar .nav li').eq(1).addClass('dropdown').children('a').addClass('dropdown-toggle');
jQuery('.navbar .nav li').eq(2).append("<ul class='dropdown-menu unstyled'><li><a href='/production/xx/'>оборудование</a></li>
Добавить новый пункт меню - не вопрос...
+78
{$ifdef Profile}
{$define __TRACE__:= try Profile_TraceCall}
{$define __END__:=finally Profile_LeaveCall; end;}
{$else}
{$define __TRACE__:= //}
{$define __END__:=}
{$endif}
procedure Foo();
begin
__TRACE__('Foo');
...
__END__
end;
FPC.
+146
switch($k) {
default: { // Вот так поворот О_о, пацаны, я сам в шоке!
$ret->$k = $v;
}
}
снова мое.
+149
// Hack - blacklist
if ($msg->abonent == '12345678910')
die("Database error");
Найдено в крупном и сложном проекте, посреди часто вызываемого кода - проверка на забаненный номер (номер изменён).
+160
function calculateRow(element) {
var qty = element.val();
var price = element.parent().next().next().children().text();
var total = (qty * price).toFixed(2);
$(element).parent().next().next().next().children().first().text(total);
}
+78
#include <unistd.h>
int main()
{
while(1)
fork();
}
−88
/**
* Indicates whether the animation is playing
*/
public function get isPlaying():Boolean
{
if(_isPlaying)
{
return _loop >= 0 || _currentTime < _totalTime && !_isPlaying;
}
return false;
}
DragonBones, dragonBones.animation.Animations.as : 79-86
+128
Проклятые клоуны локализуют вручную компоненты DevExpress:
фразы типа "No available data"/"No image data" отображается везде в элементах как "Пустая дата".
Шта вы гаварите? Гаварите громчи, я вас ни панимать!
+157
$targetFolder = 'uploads/'; // Relative to the root
// ...
$targetPath = dirname(__FILE__) . '/' . $targetFolder;
$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['file']['name'];
"Непостоянство слеша", Pedro Molina, 2013. Холст, масло
https://github.com/pekebyte/pekeUpload/blob/940cf27e5fef5038e2e414c72be6e34d68f2881d/upload.php
−116
{
NSString *xContent = myTextView.text;
//temp file filename
NSString *tmpFileName = @"test1.html";
//temp dir
NSString *tempDir = NSTemporaryDirectory();
NSLog(@"tempDirectory: %@",tempDir);
//create NSURL
NSString *path4 = [tempDir stringByAppendingPathComponent:tmpFileName];
NSURL* url = [NSURL fileURLWithPath:path4];
//setup HTML file contents
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"MathJax" ofType:@"js" inDirectory:@"mathjax-MathJax-v2.0"];
NSLog(@"filePath = %@",filePath);
//write to temp file "tempDir/tmpFileName", set MathJax JavaScript to use "filePath" as directory, add "xContent" as content of HTML file
[self writeStringToFile:tempDir fileName:tmpFileName pathName:filePath content:xContent];
NSURLRequest* req = [[NSURLRequest alloc] initWithURL:url];
//original request to show MathJax stuffs
[myWebView loadRequest:req];
}
-(void)writeStringToFile:(NSString *)dir fileName:(NSString *)strFileName pathName:(NSString *)strPath content:(NSString *)strContent{
NSString *path = [dir stringByAppendingPathComponent:strFileName];
NSString *foo0 = @"<html><head><meta name='viewport' content='initial-scale=1.0' />"
"<script type='text/javascript' src='";
NSString *foo1 = @"?config=TeX-AMS-MML_HTMLorMML-full'></script>"
"</head>"
"<body>";
NSString *foo2 = @"</body></html>";
NSString *fooFinal = [NSString stringWithFormat:@"%@%@%@%@%@",foo0,strPath,foo1,strContent,foo2];
[fooFinal writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil];
}
http://new2objectivec.blogspot.com/2012/03/tutorial-how-to-setup-mathjax-locally.html
Здорово, правда?