- 1
$i = 0; // Счетчик
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+140
$i = 0; // Счетчик
+35
assert( -(PHP_INT_MAX + 1) === -PHP_INT_MAX - 1 );
assert( -(PHP_INT_MAX + 2) === -PHP_INT_MAX - 2 );
+130
<div id="busyList" class="busyList">
<div id="busyList" class="busyList">...</div>
<div id="busyList" class="busyList">...</div>
<div id="busyList" class="busyList">...</div>
<div id="busyList" class="busyList">...</div>
<div id="busyList" class="busyList">...</div>
<div id="busyList" class="busyList">...</div>
</div>
Как-то даже грустно становится...
+126
private Listener<BaseEvent> blurListener = new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
Component item = getComponent(be);
if(focusedItem == item) {
focusedItem = item;
}
}
}
Даже боюсь предположить, зачем это.
+127
<ul>
<li><label><input class="smert_zaemchika" type="checkbox" /> Смерть заемщика</label></li>
<li><label><input class="poterya_raboty" type="checkbox" /> Потеря работы</label></li>
<li><label><input class="ne_nado" type="checkbox" /> Нет</label></li>
</ul>
не могу больше молчать......
+57
$aMethods[] = array(
'call' => 'getNewCount',
'requires' => array(
'user_id' => 'user_id'
),
'detail' => Phpfox::getPhrase('notification.get_the_total_number_of_unseen_notifications_if_you_do_not_pass_the_user_id_we_will_return_information_about_the_user_that_is_currently_logged_in'),
'type' => 'GET',
'response' => '{"api":{"total":5,"pages":0,"current_page":0},"output":5}'
);
Движок Phpfox 3.3. Самая длинная фраза сообщения :))
−157
class SomeModel < ActiveRecord::Base
after_save :some_method
def some_method
self.save
end
end
Рекурсивная рекурсия рекурсивна.
+156
var Utils = {
// https://gist.github.com/1308368
uuid: function(a,b){for(b=a='';a++<36;b+=a*51&52?(a^15?8^Math.random()*(a^20?16:4):4).toString(16):'-');return b},
pluralize: function( count, word ) {
return count === 1 ? word : word + 's';
},
store: function( namespace, data ) {
if ( arguments.length > 1 ) {
return localStorage.setItem( namespace, JSON.stringify( data ) );
} else {
var store = localStorage.getItem( namespace );
return ( store && JSON.parse( store ) ) || [];
}
}
};
+69
public static void main(String[] args) throws Exception {
// ProblemFactory in action...
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilderFactory.setValidating(false);
docBuilderFactory.setNamespaceAware(false);
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
// I really don't want to download that stupid DTD from w3c.org
docBuilder.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
return new InputSource(new StringReader(""));
}
});
// Just fine
Document doc = docBuilder.parse("http://govnokod.ru/comments");
// ProblemFactory again
XPathFactory xpathFactory = XPathFactory.newInstance();
XPath xpath = xpathFactory.newXPath();
// Just fine
NodeList nodes = (NodeList)xpath.evaluate("//li[@class='hentry']", doc, XPathConstants.NODESET);
Pattern topicUriRegex = Pattern.compile("^.*/(\\d+)$");
// This is Java, not C. Why I need to write that shitty loop?!
for (int i=0, n=nodes.getLength(); i<n; i++) {
Node node = nodes.item(i);
String author = xpath.evaluate(".//strong[@class='entry-author']/a/text()", node);
String language = xpath.evaluate(".//a[@rel='chapter']/text()", node);
String topicUri = xpath.evaluate(".//a[@rel='bookmark'][@class='entry-title']/@href", node);
Matcher m = topicUriRegex.matcher(topicUri);
String topicId = m.matches() ? m.group(1) : "неизвестный говнокод";
String text = xpath.evaluate(".//div[@class='entry-comment']", node);
System.out.println("==== " + author + " наложил в " + topicId + " (" + language + ") ====");
System.out.println(text);
System.out.println("");
}
}
Треш угар и содомия.Java, DOM и парсер уютненького.
+58
// Дополняем недостающие данные товаров
foreach($product_data as $p_key => $p_dat) {
if(!isset($p_dat['product_id'])) {
unset($product_data[$p_key]);
$this->remove($p_dat['def_key']);
continue;
}
}
Фееричный комментарий!