-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+73
- 1
- 2
- 3
- 4
- 5
- 6
- 7
@GET
@Path("/store")
void getStoreSummary(@QueryParam("id") final String id, final MethodCallback<StoreSummary> callback);
@GET
@Path("/store")
void getStoreDetails(@QueryParam("id") final String id, @QueryParam("detailed") final boolean mustBeTrue, final MethodCallback<StoreInfo> callback);
Есть API-вызов HTTP GET, который по ?detailed=true возвращает расширенный JSON с дополнительными полями.
И вот в RestyGWT, оказывается, по-другому никак. То есть если бы других параметров запроса не было, можно было бы просто написать
@Path("/store?detailed=true")
. Но он не умеет добавлять динамические параметры запроса к захардкоженным. Если попытаться - получается два вопросительных знака: [/code]/store?detailed=true?id=[id][/code].
someone,
06 Ноября 2014
-
+135
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
void SoundService::stop(){
if (mOutputMixObj != NULL) {
(*mOutputMixObj)->Destroy(mOutputMixObj);
mOutputMixObj = NULL;
}
if(mEngineObj != NULL){
(*mEngineObj)->Destroy(mEngineObj);
mEngineObj = NULL; mEngine = NULL;
}
}
Случайно нашёл в книге по Android NDK, открытой на случайной странице.
tehned,
30 Октября 2014
-
+42
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
class Message {
public:
explicit Message(Level level);
~Message();
Level level() const { return level_; }
const time_t& time() const { return time_; }
std::string text() const { return s_.str(); }
bool enabled() const { return enabled_; }
template<class T>
Message& operator << (const T& t)
{
if (enabled_)
s_ << t;
return *this;
}
Message(Message& msg) { moveFrom(msg); }
Message& operator = (Message& msg) { moveFrom(msg); return *this; }
struct Ref {
explicit Ref(Message& msg): msg_(&msg) {}
Message* msg_;
};
operator Ref() { return Ref(*this); }
Message(Ref r) { moveFrom(*r.msg_); }
Message& operator = (Ref r) { moveFrom(*r.msg_); return *this; }
private:
Level level_;
time_t time_;
std::ostringstream s_;
bool enabled_;
void moveFrom(Message& msg)
{
level_ = msg.level_;
time_ = msg.time_;
s_.str(msg.s_.str());
enabled_ = msg.enabled_;
msg.enabled_ = false;
}
};
move головного мозга
roman-kashitsyn,
30 Октября 2014
-
+121
- 1
- 2
- 3
- 4
- 5
if (Ints.contains(new int[] { 4, 5 }, statusCode / 100)) {
// error response
} else {
// success response
}
Насколько я знаю, Apache HTTP Client не содержит "официального" метода для определения категории кода состояния. Приходится так.
someone,
23 Октября 2014
-
+153
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
/*рыба*/
$render['variables']['winter_complite'] = array(
'Жилищный фонд' =>100
,'Котельные' =>100
,'Тепловые сети' =>100
,'Водопроводные сети' =>100
,'Канализационные сети' =>100
,'Создание запасов топлива' =>100
);
reformat me!
memclutter,
19 Октября 2014
-
+161
- 1
- 2
- 3
- 4
try {
Transform_Excel::$zohoFilterEbanyKostyl2 = true;
$importService->import($id);
Helpers_Response::json([
limitium,
02 Октября 2014
-
+128
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
<a href="#" id="foo" onclick="this.nextSibling.style.display=''; return!1;">Click here for view</a><p style="display: none;">
<noscript>
</p>
<style type="text/css"> a#foo { display:none; } </style>
<p>
</noscript>
/*... some info ...*/
</p>
Баян, не? Вот. Наговнокодилось. captcha=5555
istem,
18 Сентября 2014
-
+129
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
class Class1
{
...
public bool checkErrors(){...}
public void DrawNumber(){...}
public void PDF_Resize(){...}
...
}
http://vk.com/feed?z=photo-30666517_340773889%2Fb5a138e78eb1b23380
dzzpchelka,
17 Сентября 2014
-
+173
- 1
var magnitude = parseInt('10' + new Array(8).join('0'));
вот такое встретилось
Sulik78,
12 Сентября 2014
-
+157
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
public function toArray()
{
$that = $this;
$profile = $this->getProfile();
return [
'sex' => $profile->getSex(),
'distance' => (int) $profile->get($profile::FIELD_DISTANCE),
'balance' => new Object_Response_Model_User_Balance($profile->get($profile::FIELD_BALANCE)),
'payments' => call_user_func(function() use ($that) {
$return = [];
$checkoutTypes = $that->getRelationCheckoutTypes()->find_all()->as_array();
foreach($checkoutTypes as $checkoutType) {
if (json_decode($checkoutType->data)[0]->value) {
$return[] = $checkoutType;
}
}
return $return;
}),
'vk' => $this->getRelationSocial()->getProfileUrl(),
'validate' => $this->getValidate()
];
};
Автор: просто php нам дало анонимные функции, почему бы ими не пользоваться?
limitium,
09 Сентября 2014