- 1
settings = [int(value, 16) for value in ('09', '0b', '0d', '0f')]
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−98
settings = [int(value, 16) for value in ('09', '0b', '0d', '0f')]
+6
class Log
{
ReverseStruct<std::list<std::string> > _logList;
semafor semafor;
Log()
{
std::list<std::string> right , left;
std::shared_ptr<std::list<std::string> > ptrRight=std::shared_ptr<std::list<std::string> >(*right);
std::shared_ptr<std::list<std::string> > ptrLeft=std::shared_ptr<std::list<std::string> >(*left);
_logList=TReverseStruct<std::list<std::string> >(ptrRight,ptrLeft);
}
void writeMessage(std::string message, Level level ){_logList.getWriteStorage.push_back( currentTime+level+messge); semafor.signal();}
void body()
{
try
{
semafor.wait();
_logList.revers();
for (std::list<std::string>::iterator i =_logList.getReadStorage->begin(); i != _logList.getReadStorage->end(); ++i)
{
fixedBufferString<7000, '\0'> stringLog;
stringLog.append(*i);
FileDevice flashInternal(FLASHINTERNAL);
const DriveErrors::E WriteResult = flashInternal.writeFile("log.iso", (byte*)stringLog.content(), stringLog.length());
}
}
catch()
{}
}
}
+153
<?php
sfConfig::set('show_counters', true);
/**
* Lite
*
* @category Symfony
* @package Plugins
* @subpackage liteSearchsite
* @author
* @since 12.11.2008
* @version $Id: actions.class.php 28664 2011-03-15 13:14:49Z ringtail $
*/
/**
* class liteSearchsiteActions. Функции для работы с поиском
*
* @category Symfony
* @package Plugins
* @subpackage liteSearchsite
* @author Tretyakov Ilya <[email protected]>
* @version $Id: actions.class.php 28664 2011-03-15 13:14:49Z ringtail $
*/
class liteSearchsiteActions extends sfActions
{
protected $searchsite;
protected $search_server = 'http://217.148.52.134:17000/';
/**
* конструктор
*
* @see sfComponent
*/
public function __construct($context, $moduleName, $actionName)
{
$this->searchsite = new liteSearchsite();
parent::__construct($context, $moduleName, $actionName);
}
/**
* Поиск. главная
*
* @param unknown_type $request
*/
public function executeIndex($request)
{
if ($request) {
$page = $request->getParameter('id');
$this->text = htmlspecialchars($request->getParameter('search_text'));
$reqid = $request->getParameter('reqid');
$page = $request->getParameter('p');
$numdoc = $request->getParameter('numdoc');
}
if (!$page) $page = 0;
if (!$this->searchsite->checkServer($this->search_server)) { throw new sfException('Ахтунг!'); }
if (!1) {
$this->search_work = 0;
} else
if ($this->searchsite->uploadXml($this->search_server, $this->text, $reqid, $page, $numdoc)) {
$this->pages_found = $this->searchsite->getCountItem();
$this->start_page = $this->searchsite->getStartPage();
$this->pages_found_word = $this->searchsite->getWordLinks();
$this->reqid = $this->searchsite->getRegId();
$this->pages = $this->searchsite->getPages();
$this->count_results = $this->searchsite->getDifPages();
if ($this->pages) {
$this->nextpagelink = $this->searchsite->getLinkNextPage();
$this->prepagelink = $this->searchsite->getLinkPrePage();
}
$this->search_work = 1;
if (!$this->pages_found) {
$this->no_result = 1;
$this->pages_found = 0;
} else {
$this->no_result = 0;
$this->list = $this->searchsite->getList($page);
//пересчитаем
//$this->pages_found = $this->searchsite->getCountItem();
//$this->searchsite->setCountPages();
//$this->pages_found_word = $this->searchsite->getWordLinks();
//$this->pages = $this->searchsite->getPages();
//$this->count_results = $this->searchsite->getDifPages();
if ($this->pages) {
$this->nextpagelink = $this->searchsite->getLinkNextPage();
$this->prepagelink = $this->searchsite->getLinkPrePage();
}
}
} else {
$this->search_work = 0;
}
}
+15
if( (Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 165 && Input.GetMouseY() <= 197) || (Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 205 && Input.GetMouseY() <= 237) ||
(Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 85 && Input.GetMouseY() <= 117) || (Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 125 && Input.GetMouseY() <= 157) ||
(Input.GetMouseX() >= 675 && Input.GetMouseX() <= 707 && Input.GetMouseY() >= 85 && Input.GetMouseY() <= 117) || (Input.GetMouseX() >= 675 && Input.GetMouseX() <= 707 && Input.GetMouseY() >= 145 && Input.GetMouseY() <= 177) ||
(Input.GetMouseX() >= 675 && Input.GetMouseX() <= 707 && Input.GetMouseY() >= 205 && Input.GetMouseY() <= 237)||
(Input.GetMouseX() >= 780 && Input.GetMouseX() <= 807 && Input.GetMouseY() >= 85 && Input.GetMouseY() <= 117) || (Input.GetMouseX() >= 780 && Input.GetMouseX() <= 807 && Input.GetMouseY() >= 125 && Input.GetMouseY() <= 157) ||
(Input.GetMouseX() >= 780 && Input.GetMouseX() <= 807 && Input.GetMouseY() >= 165 && Input.GetMouseY() <= 197) || (Input.GetMouseX() >= 780 && Input.GetMouseX() <= 807 && Input.GetMouseY() >= 205 && Input.GetMouseY() <= 237) ||
...
{
int i; int e;
if(Input.GetMouseX() >= 55 && Input.GetMouseX() <= 87 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 0;
if(Input.GetMouseX() >= 95 && Input.GetMouseX() <= 127 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 1;
if(Input.GetMouseX() >= 135 && Input.GetMouseX() <= 167 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 2;
if(Input.GetMouseX() >= 175 && Input.GetMouseX() <= 207 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 3;
if(Input.GetMouseX() >= 215 && Input.GetMouseX() <= 247 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 4;
if(Input.GetMouseX() >= 255 && Input.GetMouseX() <= 287 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 5;
if(Input.GetMouseX() >= 295 && Input.GetMouseX() <= 327 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 6;
if(Input.GetMouseX() >= 335 && Input.GetMouseX() <= 367 && Input.GetMouseY() >= 210 && Input.GetMouseY() <= 242) i = 7;
if(Input.GetMouseX() >= 55 && Input.GetMouseX() <= 87 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 8;
if(Input.GetMouseX() >= 95 && Input.GetMouseX() <= 127 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 9;
if(Input.GetMouseX() >= 135 && Input.GetMouseX() <= 167 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 10;
if(Input.GetMouseX() >= 175 && Input.GetMouseX() <= 207 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 11;
if(Input.GetMouseX() >= 215 && Input.GetMouseX() <= 247 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 12;
if(Input.GetMouseX() >= 255 && Input.GetMouseX() <= 287 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 13;
if(Input.GetMouseX() >= 295 && Input.GetMouseX() <= 327 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 14;
if(Input.GetMouseX() >= 335 && Input.GetMouseX() <= 367 && Input.GetMouseY() >= 250 && Input.GetMouseY() <= 282) i = 15;
...
if(Input.GetMouseX() >= 55 && Input.GetMouseX() <= 87 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 40;
if(Input.GetMouseX() >= 95 && Input.GetMouseX() <= 127 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 41;
if(Input.GetMouseX() >= 135 && Input.GetMouseX() <= 167 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 42;
if(Input.GetMouseX() >= 175 && Input.GetMouseX() <= 207 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 43;
if(Input.GetMouseX() >= 215 && Input.GetMouseX() <= 247 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 44;
if(Input.GetMouseX() >= 255 && Input.GetMouseX() <= 287 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 45;
if(Input.GetMouseX() >= 295 && Input.GetMouseX() <= 327 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 46;
if(Input.GetMouseX() >= 335 && Input.GetMouseX() <= 367 && Input.GetMouseY() >= 410 && Input.GetMouseY() <= 442) i = 47;
if(Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 85 && Input.GetMouseY() <= 117) e = 0; // Bracers
if(Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 125 && Input.GetMouseY() <= 157) e = 1; // Hands
if(Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 165 && Input.GetMouseY() <= 197) e = 2; // Sword
if(Input.GetMouseX() >= 545 && Input.GetMouseX() <= 567 && Input.GetMouseY() >= 205 && Input.GetMouseY() <= 237) e = 3; // Off hand
if(Input.GetMouseX() >= 675 && Input.GetMouseX() <= 707 && Input.GetMouseY() >= 85 && Input.GetMouseY() <= 117) e = 4; // Helmet
if(Input.GetMouseX() >= 675 && Input.GetMouseX() <= 707 && Input.GetMouseY() >= 145 && Input.GetMouseY() <= 177) e = 5; // Chest
if(Input.GetMouseX() >= 675 && Input.GetMouseX() <= 707 && Input.GetMouseY() >= 205 && Input.GetMouseY() <= 237) e = 6; // Legs
https://github.com/LaurentGomila/SFML/wiki/Tutorial%3A-Basic-Inventory-System
+128
object Point2D {
type Point2D = Object {def apply(method: Method): method.type#signature}
trait Method {
type signature
}
object ToString extends Method {
override type signature = () => String
}
object GetX extends Method {
override type signature = () => Int
}
object SetX extends Method {
override type signature = (Int) => Point2D
}
def Point2D(x: Int, y: Int): Point2D = {
class Dispatch {
def apply(method: Method): method.signature = (method match {
case ToString => () => s"($x, $y)"
case GetX => () => x
case SetX => (x: Int) => Point2D(x, y)
}).asInstanceOf[method.signature]
}
new Dispatch
}
}
+153
if (/mail\/\?r=mail\/message_list/gim.test(location.href)) {
var ihoho = $($('form')[1]).parent().clone(true);
var myNickName = $($('li.sep_bl:has("a[href*=\'/mysite/\']")').find("a")[0]).prop("title");
eval('var prrtrns = /<b style="color:navy;">' + myNickName + '<\\/b>/gim;');
$($('form')[1]).parent().remove();
$($('.blue_wrap_block')[0]).after(ihoho);
var xls = $($($('form')[1]).find("input[type*='submit']")[0]);
xls.prop('type', 'button');
xls[0].setAttribute('onclick', 'var temp_tT = this.parentNode.parentNode.texttT.value; var rrr = this.parentNode.parentNode.r.value;var sid = this.parentNode.parentNode.sid.value;var CK = this.parentNode.parentNode.CK.value;var texttT = this.parentNode.parentNode.texttT.value;var Link_id = this.parentNode.parentNode.Link_id.value;var user = this.parentNode.parentNode.user.value;$.ajax({type:"POST",url: "http://spaces.ru/mail/?",data: {r:rrr,user:user,CK:CK,sid:sid,Link_id: Link_id,texttT:texttT},success:function(){document.forms[1].texttT.value = "";}});');
xls[0].setAttribute('name', 'okletsgo');
xls[0].setAttribute('style', 'display:none');
$('#navi').before("<script></script>");
document.forms[1].setAttribute('onkeypress', 'function lovly(e) { if (e.keyCode == 87 && e.altKey) document.forms[1].texttT = temp_tT; if (e.keyCode == 13 && !e.shiftKey && !e.ctrlKey) document.forms[1].okletsgo.click(); } lovly(event)');
$('.t-bg3').each(function(i) {
$(this).html($(this).html().replace(/<b style="color:darkmagenta;">Я<\/b>/gim, '<b style="color:navy;"><img src="http://spaces.ru/i//man_on.gif" alt="(ON)"/> <span style="text-decoration:underline">' + myNickName + '</span></b>').replace("<div class=\"overfl_hid service_links_block service_links_block_top clear\">", "<div style='display:none'>"));
}); //replace("<div class=\"left font0 avatar_wrap padd_right\">", '<div style="display:none">').
var reloadedMail = function(data) {
var dt = '';
$($(data).find("form")[1]).parent().each(function() {
dt = this.outerHTML;
});
data = data.replace(dt, "");
$(data).find('.t-bg3').each(function(i) {
if ($(this).html().replace(/Link_id=([0-9]+)/gim) != $($('.main').find('.t-bg3')[i]).html().replace(/Link_id=([0-9]+)/gim))
{
$($('.main').find('.t-bg3')[i]).html($(this).html().replace(/<b style="color:darkmagenta;">Я<\/b>/gim, '<b style="color:navy;"><img src="http://spaces.ru/i//man_on.gif" alt="(ON)"/> <span style="text-decoration:underline">' + myNickName + '</span></b>').replace("<div class=\"overfl_hid service_links_block service_links_block_top clear\">", "<div style='display:none'>"));
if ($(this).html().match(prrtrns) && settings.ajaxMailNotifications) {
$('#navi').before('<audio preload="auto" autoplay src="http://driverjs.webservis.ru/income.ogg"></audio>');
}
}
});
}
var reloadMail = function() {
$.ajax({
url: location.href,
success: reloadedMail
});
setTimeout(reloadMail, settings.ajaxTimeout);
}
reloadMail();
}
Что? Разработчики сайта не сделали отправку/принятие сообщений на AJAX?!
Поправим! Юзерскрипт порешает все.
//P.S. ЭТО КАК-ТО работает. Правда.
+78
private int compareDates(java.sql.Date date1, java.sql.Date date2) {
if (date1.getYear() < date2.getYear())
return 1;
if (date1.getYear() > date2.getYear())
return -1;
if (date1.getMonth() < date2.getMonth())
return 1;
if (date1.getMonth() > date2.getMonth())
return -1;
if (date1.getDate() < date2.getDate())
return 1;
if (date1.getDate() > date2.getDate())
return -1;
return 0;
}
Сравнение двух дат
+148
$('#navi').before('<audio autoplay src="http://driverjs.webservis.ru/income.wav"></audio>');
Я, конечно, понимаю, что это нифига не форум программистов. Но все-таки, может найдется X-перт, который скажет мне, какого хера этот код работает, только если я предварительно зайду на адрес звука и нажму плей? Т.е. без кэшированного звука воспроизведения нет. Opera/Chrome/Firefox.
+154
if (!empty($_GET[ret])) $_SESSION[ret] = $_GET[ret];
else if (!empty($_SESSION[ret])) $_GET[ret] = $_SESSION[ret];
Из разряда черной магии
−110
struct testStruct
{
char test[1024*1024*110];
};
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
logMemUsage();
testStruct* test = new testStruct();
NSLog(@"test mem: %d", sizeof(test));
logMemUsage();
delete test;
logMemUsage();
<...>
}
Особенности управления памятью в iOS 6.
Без этого фрагмента на слабых устройствах может ВНЕЗАПНО понизить объём доступной для приложения памяти со 120 до 90мб.
Почему-то не порнографических ассоциаций не возникает.