- 1
BOOL isEven = ([self.packet.teamLeadPlaces count] / 2.0f - floor([self.packet.teamLeadPlaces count] / 2.0f) < 0.1f);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−389
BOOL isEven = ([self.packet.teamLeadPlaces count] / 2.0f - floor([self.packet.teamLeadPlaces count] / 2.0f) < 0.1f);
Не ну а чо, работает же.
+160
if (isset($_GET['page'])) {
include "pages/index.php";
}
if (isset($_GET['accounts'])) {
include "pages/allacc.php";
}
if (isset($_GET['gold'])) {
include "pages/gold.php";
}
if (isset($_GET['send'])) {
include "pages/send.php";
}
if (isset($_GET['gm'])) {
include "pages/gm.php";
}
if (isset($_GET['ban'])) {
include "pages/ban.php";
}
if (isset($_GET['chat'])) {
include "pages/chat.php";
}
if (isset($_GET['tw'])) {
include "pages/tw.php";
}
if (isset($_GET['server'])) {
include "pages/server.php";
}
if (isset($_GET['logs'])) {
include "pages/logs.php";
}
if (isset($_GET['live_chat'])) {
include "pages/live_chat.php";
}
if (isset($_GET['chars'])) {
include "pages/chars.php";
}
//Functions
if (isset($_GET['Acc_Change'])) {
if (isset($_POST['SaveChange'])) {
$iwp->SaveUserToMysql(strtolower($_POST['name']), strtolower($_POST['pass']), strtolower($_POST['email']), $_POST['PassType']);
}
if (isset($_POST['DeleteAcc'])) {
echo "<script>alert('Вы точно хотите удалить этот аккаунт?');location.href='index.php?Acc_Change&DeleteYes=$_POST[AccID]';</script>";
}
if (isset($_GET['DeleteYes'])) {
mysql_query("DELETE FROM users WHERE ID=$_GET[DeleteYes]");
echo "<script>alert('Аккаунт успешно удален');location.href='index.php?accounts';</script>";
}
include "pages/acc_change.php";
}
if (isset($_GET['Give_Gold'])) {
if(isset($_POST['GiveGold'])) {
$iwp->GiveGold($_POST['GoldID'], $_POST['GoldNum'], "user");
}
if(isset($_POST['GoldWhoOnline'])) {
$iwp->GiveGold(null, $_POST['AllGold'], "online");
}
if(isset($_POST['GoldAll'])) {
$iwp->GiveGold(null, $_POST['AllGolds'], "all");
}
}
http://kn1fe-zone.ru/index.php?threads/iwp-veb-panel-upravlenija-serverom.10/#post-1554
Автор называет это ООП.
Полный архив — https://www.dropbox.com/s/gpdge94t0jv9hl9/IWP%2806.08.2014%29pre.rar?dl=0
Можно просматривать для успокоения души своей перед сном.
+154
$this->template_model = BaseCommunicationType::model()->findByAttributes(array('template' => $this->template));
if(!$this->template_model === NULL) {
throw new Exception("Template name is wrong", 1);
}
Угадайте, что будет из исключением?
+135
void *list_find_data(struct node *llist, void *data, int (*cmp_func)(void *, void *))
{
struct node* it_node = NULL;
if (NULL != cmp_func)
{
for(it_node = llist; (NULL != it_node); it_node = it_node->next)
{
if (NULL != it_node->data)
{
if (0 == cmp_func(data, it_node->data))
{
break;
}
}
}
}
return ((NULL != it_node) && (NULL != it_node->data)) ? it_node->data : NULL;
}
Велосипедисты жгут. О glibопараше не наслышаны.
+158
for($i = 0; $i < $db->max; $i++) {
if($i==1) continue;
.....
}
Почему бы и нет
+52
#include <iostream>
using namespace std;
void foo()
{
int i = 0xffffffff;
cout << i << endl;
}
void bar()
{
bool b;
if(b)
{
cout << "true" << endl;
}
if(!b)
{
cout << "false" << endl;
}
}
int main()
{
foo();
bar();
return 0;
}
http://rextester.com/HJRO12041
−133
Public m_Values As Hashtable
Public Function GetSensorType(p_SensorType As SensorType) As SensorValue
For Each de As DictionaryEntry In m_Values
If CType(de.Key, SensorType) = p_SensorType Then
Return de.Value
End If
Next
Return Nothing
End Function
Отличный пример работы с Hashtable!
+142
// string errorMessage;
if (result == false)
result = true; //because model is not changed
because
+53
/* set _god=true temporarily, safely */
class GodScope {
bool _prev;
public:
GodScope();
~GodScope();
};
mongo/db/client.h
Почувствуй простор божий
+91
program lab2;
const n = 5;
var i:integer;
var A, x1, dx:single;
var arrayX : array[1..n] of single;
var arrayY : array[1..n] of single;
begin
readln(A);
x1:= -1 * 2.2 * A;
dx:= A/5;
arrayX[1]:= x1;
for i:=2 to n do
arrayX[i]:= arrayX[i - 1] + dx;
for i:=1 to n do
begin
if (arrayX[i] < 0) then
arrayY[i]:= -1 * sqrt(sqrt(16 * sqr(sqr(A)) + 4 * sqr(A) * sqr(arrayX[i] + A)) - sqr(arrayX[i] + A) - sqr(A))
else
arrayY[i]:= sqrt(sqr(A) - sqr(arrayX[i] + A)) - 2 * A;
writeln(arrayX[i], ' ; ', arrayY[i]);
end;
readln;
end.
govno, govno, govnyanoe