- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
if(!flashVarsPriority) //Если данные из конфига приоритетнее флешварсов
saveFlashVars(flashVars);
//Тут парсим XML конфиг
...
//много строк
if(flashVarsPriority) //если флешварсы приоритетнее
saveFlashVars(flashVars);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−124
if(!flashVarsPriority) //Если данные из конфига приоритетнее флешварсов
saveFlashVars(flashVars);
//Тут парсим XML конфиг
...
//много строк
if(flashVarsPriority) //если флешварсы приоритетнее
saveFlashVars(flashVars);
+168
Функция Антимата
<?php
//Маты записываёте в antmat.dat
function antimat($msg) {
if (file_exists("antimat.dat")) {
$mat = file_get_contents("antimat.dat");
$arr_mat = explode("|",$mat);
foreach($arr_mat as $value) {
if($value != "") {
$msg = preg_replace("|$value|iu","***",$msg);
}}}
return $msg;
}
?>
И заходишь на любой форум про похапе
@
И копируешь на говнокод всю тему "полезные функции"
+154
<?php
function crypt_apr1_md5($plainpasswd) {
$salt = substr(str_shuffle("abcdefghijklmnopqrstuvwxyz0123456789"), 0, 8);
$len = strlen($plainpasswd);
$text = $plainpasswd.'$apr1$'.$salt;
$bin = pack("H32", md5($plainpasswd.$salt.$plainpasswd));
for($i = $len; $i > 0; $i -= 16) { $text .= substr($bin, 0, min(16, $i)); }
for($i = $len; $i > 0; $i >>= 1) { $text .= ($i & 1) ? chr(0) : $plainpasswd{0}; }
$bin = pack("H32", md5($text));
for($i = 0; $i < 1000; $i++) {
$new = ($i & 1) ? $plainpasswd : $bin;
if ($i % 3) $new .= $salt;
if ($i % 7) $new .= $plainpasswd;
$new .= ($i & 1) ? $bin : $plainpasswd;
$bin = pack("H32", md5($new));
}
for ($i = 0; $i < 5; $i++) {
$k = $i + 6;
$j = $i + 12;
if ($j == 16) $j = 5;
$tmp = $bin[$i].$bin[$k].$bin[$j].$tmp;
}
$tmp = chr(0).chr(0).$bin[11].$tmp;
$tmp = strtr(strrev(substr(base64_encode($tmp), 2)),
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
return "$"."apr1"."$".$salt."$".$tmp;
}
?>
Кручу-верчу, запутать хочу!
−117
public function loadFromDecString(colorData:String, splitter:String = " "):void
{
var colorArray:Array = colorData.split(splitter);
if(colorArray.length != 3)
return;
mRed = colorArray[0] * 0x1;
mGreen = colorArray[1] * 0x1;
mBlue = colorArray[2] * 0x1;
}
Чудеса в решете
−91
def delta( listToDelta ):
result = []
lastItem = listToDelta[0]
for i, item in enumerate(listToDelta):
if i == 0:
result.append(item)
else:
result.append(item-lastItem)
lastItem = item
return result
l = [2, 4, 6, 9, 7]
print(l)
l = delta(l)
print(l)
Всеми любимый Дениска (автор некоторых прошлых ГК на питоне) пошёл на поправку и написал не такое вонючее говно.
Комментировать код до сих пор отказывается, но зато стал выбирать имена для переменных получше.
+169
if (!document.getElementById) return;
Официальный сайт города Сочи
+161
public function get($module, $fields, $options=null) {
$results = $this->get_with_related($module, array($module => $fields), $options);
$records = array();
if ($records) {
foreach ($results['entry_list'] as $entry) {
$record = array();
foreach ($entry['name_value_list'] as $field) {
$record[$field['name']] = $field['value'];
}
$records[] = $record;
}
}
return $records;
}
SugarCRM REST API Class https://github.com/asakusuma/SugarCRM-REST-API-Wrapper-Class/blob/master/sugar_rest.php
+105
procedure TForm2.FormCreate(Sender: TObject);
begin
SpeedButton1.Left := Form2.ClientWidth div 2 - SpeedButton1.Width;
SpeedButton1.Top := Form2.ClientHeight div 2 - SpeedButton1.Height;
SpeedButton2.Left := Form2.ClientWidth div 2;
SpeedButton2.Top := Form2.ClientHeight div 2 - SpeedButton2.Height;
SpeedButton3.Left := Form2.ClientWidth div 2 - SpeedButton3.Width;
SpeedButton3.Top := Form2.ClientHeight div 2;
SpeedButton4.Left := Form2.ClientWidth div 2;
SpeedButton4.Top := Form2.ClientHeight div 2;
end;
+168
var command = 'var p = new Object();';
command +='p.adId = "' + params.adId + '";';
command +='p.campaignId = "' + params.campaignId + '";';
command +='p.parentPositionId="' + params.parentPositionId + '";';
command +='p.childPositionIds = "' + params.childPositionIds + '";';
command +='oneAdSkyscraperLoaded(p);';
setTimeout(command, 0);
Латвийский eval
+156
/**
* форматирование даты - преобразует дату в формат ДД-ММ-ГГГГ
*
* @param unknown_type $inDate - дата
* @return unknown
*/
public static function getDateFormatted($inDate, $forView = false, $inTime = '') {
//2011-05-03 20:27:26
$a_tmp = explode(' ', $inDate);
if ($forView) {
$time = substr($a_tmp[1], 0, 5);
if ($a_tmp[0] == date('Y-m-d')) {
if ($time == '') {
$time = substr($inTime, 11, 5);
if ($time == '') {
$time = $inTime;
}
}
if ($time != '') {
return 'Сегодня, ' . $time;
}
}
$a_tmp = explode('-', $a_tmp[0]);
return $a_tmp[2] . '-' . $a_tmp[1] . '-' . $a_tmp[0];
}
$inDate = substr($inDate, 0 , 10);
$inDate = str_replace(' ', '', $inDate);
$inDate = str_replace('.', '-', $inDate);
$a_tmp = explode('-', $inDate);
if (strlen($a_tmp[0]) == 4) {
$inDate = str_pad($a_tmp[2], 2, '0', STR_PAD_LEFT) . '-' . $a_tmp[1] . '-' . $a_tmp[0];
}
return $inDate;
}