- 1
- 2
- 3
- 4
private function uncaughtError (e:UncaughtErrorEvent):void {
// be a good girl and swallow
e.stopImmediatePropagation ();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−120
private function uncaughtError (e:UncaughtErrorEvent):void {
// be a good girl and swallow
e.stopImmediatePropagation ();
}
написал какую-то хуету и сижу, радуюсь как маленький. да, я хочу поговорить об этом.
+8
#include <iostream>
struct Reader_msg;
template<class T>struct TMsg;
struct IMsg
{
virtual ~IMsg(){}
virtual void SendCast(Reader_msg& obj) = 0;
};
struct Some{};
struct Reader_msg
{
template<class T> void ReadMsg(T& msg)
{
//Здесь можно приляпать статик_ассерт
std::cout<<"ERROR UNKNOW TYPE \n";
}
void ReadMsg(int msg) { (void)msg; std::cout<<"TYPE IS INT\n"; }
void ReadMsg(float msg) { (void)msg; std::cout<<"TYPE IS FLOAT\n"; }
void ReadMsg(Some msg) { (void)msg; std::cout<<"TYPE IS SOME\n"; }
template<class T>void TakeMsg(T& msg) { msg.SendCast(*this); }
};
template<class T>struct TMsg:IMsg
{
T data;
void SendCast(Reader_msg& obj){ obj.ReadMsg(data); }
};
int main()
{
Reader_msg reader;
TMsg<int> msg1;
TMsg<float> msg2;
IMsg& msg3 = msg1;
IMsg& msg4 = msg2;
TMsg<Some> msg5;
TMsg<double> msg6;
reader.TakeMsg(msg1);
reader.TakeMsg(msg2);
reader.TakeMsg(msg3);
reader.TakeMsg(msg4);
reader.TakeMsg(msg5);
reader.TakeMsg(msg6);
}
http://liveworkspace.org/code/4FHDTq$6
+47
function executeNewsRightRelated(sfWebRequest $request)
{
$siteId = $request->getParameter('site')->id;
$tNewsList = $this->object->News;
$newsList = array();
foreach ($tNewsList as $news) {
$ids = array();
foreach ($news->Sites as $idModel) {
$ids[] = $idModel->id;
}
if (in_array($siteId, $ids)) {
$newsList[] = $news;
}
}
$this->newsList = $newsList;
}
+110
int strnlen(const char *s, int size)
{
int i;
for(i=0; i<size; i++) if(!*s) break;
return i;
}
+139
List<string> duplicities = new List<string>();
foreach (var localItem in FileCollectionLocal)
{
foreach (var remoteItem in FileCollectionRemote)
{
if (localItem.FileName == remoteItem.FileName)
{
duplicities.Add(localItem.FileName);
}
}
}
+129
> echo 1 >1.cp
> echo 1 >1.cpp
> echo 1 >1.cppp
> dir /b *.cp
1.cp
> dir /b *.cpp
1.cpp
1.cppp
Баг в FindFirstFile/FindNextFile, показан на виндовом dir для простоты демонстрации. Призрак DOS'а жив даже в семерке...
−161
create temp table data (id serial, o1 money(16,2) default 0, o2 money(16,2) default 0,
o3 money(16,2) default 0, o4 money(16,2) default 0, o5 money(16,2) default 0,
o6 money(16,2) default 0, o7 money(16,2) default 0, o8 money(16,2) default 0,
o9 money(16,2) default 0, o10 money(16,2) default 0, o11 money(16,2) default 0,
o12 money(16,2) default 0, o13 money(16,2) default 0, o14 money(16,2) default 0,
o15 money(16,2) default 0, o16 money(16,2) default 0, o17 money(16,2) default 0,
o18 money(16,2) default 0, o19 money(16,2) default 0, o20 money(16,2) default 0,
o21 money(16,2) default 0, o22 money(16,2) default 0, o23 money(16,2) default 0,
o24 money(16,2) default 0, o25 money(16,2) default 0, o26 money(16,2) default 0,
o27 money(16,2) default 0, o28 money(16,2) default 0, o29 money(16,2) default 0,
o30 money(16,2) default 0, o31 money(16,2) default 0, f1 money(16,2) default 0,
f2 money(16,2) default 0, f3 money(16,2) default 0, f4 money(16,2) default 0,
f5 money(16,2) default 0, f6 money(16,2) default 0, f7 money(16,2) default 0,
f8 money(16,2) default 0, f9 money(16,2) default 0, f10 money(16,2) default 0,
f11 money(16,2) default 0, f12 money(16,2) default 0, f13 money(16,2) default 0,
f14 money(16,2) default 0, f15 money(16,2) default 0, f16 money(16,2) default 0,
f17 money(16,2) default 0, f18 money(16,2) default 0, f19 money(16,2) default 0,
f20 money(16,2) default 0, f21 money(16,2) default 0, f22 money(16,2) default 0,
f23 money(16,2) default 0, f24 money(16,2) default 0, f25 money(16,2) default 0,
f26 money(16,2) default 0, f27 money(16,2) default 0, f28 money(16,2) default 0,
f29 money(16,2) default 0, f30 money(16,2) default 0, f31 money(16,2) default 0,
ftot money(16,2) default 0)
... must be funny in the rich man's world ...
+54
<?php
class ArrObj implements ArrayAccess, Countable, Iterator
{
protected $_data = array();
protected $_indexes = array();
protected $_pos = 0;
public function __construct($data = array())
{
$this->_data = $data;
}
public function offsetGet($name)
{
if($isset = isset($this->_data[$name])) return $this->_data[$name];
$this->_data[$name] = new self();
return $isset ? $this->_data[$name] : null;
}
public function offsetSet($name, $value)
{
if(is_array($value)) $value = new self($value);
$this->_data[$name] = $value;
$this->_indexes[] = $name;
return $value;
}
public function offsetUnset($name)
{
unset($this->_data[$name]);
$this->_indexes = array_merge(array_diff($this->_indexes, array($name)));
}
public function offsetExists($name)
{
return isset($this->_data[$name]);
}
public function count()
{
return count($this->_data);
}
public function rewind()
{
$this->_pos = 0;
}
public function current()
{
return $this->_data[$this->_indexes[$this->_pos]];
}
public function key()
{
return $this->_indexes[$this->_pos];
}
public function next()
{
++$this->_pos;
}
public function valid()
{
return isset($this->_indexes[$this->_pos]);
}
}
?>
+14
/*!
* \brief Checks for a file existence
*/
inline bool IsFolderExist( const boost::filesystem::path &path )
{
return boost::filesystem::exists( path ) && boost::filesystem::is_directory( path );
}
/*!
* \brief Checks for a folder existence
*/
inline bool IsFileExist( const boost::filesystem::path &path )
{
return boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path );
}
Нашёл у себя в проекте. Кручу верчу - обмануть хочу). Про то, что даже правильные комментарии тут нафиг не нужны - я уже молчу.
+49
If($z["timeout"]==1 || $z['timeout']==3 || $z['timeout']==4 || $z['timeout']==5 || $z['timeout']==7 || $z['timeout']==10) {
} else {
$z['timeout'] = 3;
}
'<>' и 'or' ? неее, не слышали!