- 1
- 2
- 3
- 4
- 5
- 6
- 7
function grabb($str, $start, $end) {
$start = strpos($str, $start) + strlen($start);
$end = strpos($str, $end, $start);
$result = substr($str, $start, $end - $start);
flush();
return $result;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+147
function grabb($str, $start, $end) {
$start = strpos($str, $start) + strlen($start);
$end = strpos($str, $end, $start);
$result = substr($str, $start, $end - $start);
flush();
return $result;
}
Человек, писавший это явно хоть раз произносил фразу "Регулярки ? Нет, не слышал."
+147
Сори что сюды, но тут быстрее всего получить ответ)))
Можете заслуженно ставить минусы.
Как мне получить доступ к типу обьявленному и зависящему от параметров по имени переменной?
Хочу сделать что то типа:
const typeof(c->active)::entry * const e = c->active.GetEntry(i);
вместо
const structs::local_db<package, 64, type>::entry *const (на практике символов больше)
взять к примеру те же итераторы.
P.S больше не буду, но мне показалось это говнокодом)
+172
element.parent().parent().next().children().filter('.type_sort').text();
почувствуй себя джойстиком
+134
<a target="_self"
href="mx/automation/delegates/advancedDataGrid/package-detail.html"
onclick="javascript:loadClassListFrame('mx/automation/delegates/advancedDataGrid/class-list.html');">
Форматирование я добавил. Источник, думаю, указывать не нужно :)
+159
#настройка
$file = file_get_contents('data/other/addsite.xml');
$count = 80;
function getDatabase($name,$file){
$DATABASE = file_get_contents('database/'.$file.'.dat');
$DATABASE = explode('|',substr($DATABASE,0,-1));
foreach($DATABASE as $datavalue){
$datavalue = explode('==',$datavalue);
$names = $datavalue[0];
$value = $datavalue[1];
$arr["$names"] = $value;
}
return $arr["$name"];
}
#обработка
preg_match_all("/<name>(.+?)<\/name>/",$file,$matches);
preg_match_all("/comment id\=\"(.+?)\"/",$file,$matchesid);
if(!isset($matches[1]))die('ничего не найдено =(');
if(!isset($matchesid[1]))die('ничего не найдено =(');
$matchesid = array_reverse($matchesid[1]);
$matches = array_reverse($matches[1]);
$urls=array();
foreach($matches as $url){
if(!$count)break;
$count--;
if(!strpos(' '.$url,'http://')){
$url = 'http://'.$url;
}
$parts = parse_url($url);
if(substr($parts['host'],0,4)=='www.'){
$purl = substr($parts['host'],4);
} else {
$purl = $parts['host'];
}
if(isset($purl)){$urls[] = $purl;}
}
$text = '';
$count2=0;
$ids=array();
$countf=80;
foreach($matchesid as $id){
if(!$countf)break;
$countf--;
$ids[] = $id;
}
foreach($urls as $href){
$count2++;
$idd = $ids["$count2"-1];
$statuss = getDatabase('uweb'.$idd,'checker');
$statusx = "<img src=\"/data/files/".$statuss.".png\" align=\"absmiddle\" />";
$text.="<span id=\"check$idd\">$statusx</span> <a href='http://$href/' target='_blank' rel='nofollow'>http://$href/</a>".($count2%20==0?'</td><td valign="top" width="25%" align="left">':'<br/>');
}
# вывод
echo "<table width='100%'><tr><td valign='top' width='25%' align='left'>".$text."</td></tr></table>";
Студия "раскрутки" сайтов uweb.su
+158
A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
Script: http://govnokod.ru/media/d10c81f141cf62e45d6f8dba139fa72d.js?files=jquery.js,govnokod.js,livecomments.js,jshighlight/highlight.pack.js&v=4:452
Говнокод в govnokod e.
+126
// Get credit spread rates and tenors
mDtCreditSpreadTenors = aRDO.GetResultTable(mSelectCreditSpreadRates, mCode, mCreditSpreadCurveDate);
// Check if any credit spread rates are returned
if (mDtCreditSpreadTenors.Rows.Count == 0)
{
// If debugging
if (System.Diagnostics.Debugger.IsAttached)
// Get from fixed date
mDtCreditSpreadTenors = aRDO.GetResultTable(mSelectCreditSpreadRates, mCode, 39396);
else
// Add error
aMissingData.Add(string.Format("Cannot find credit spread rates for date {0}", mCreditSpreadCurveDate.ToShortDateString()));
}
Счастливой отладки, суки!
+147
public static function prepareHTML ($inStr) {
return htmlspecialchars(htmlspecialchars_decode($inStr));
}
+154
function get_sql($_POST){
$fields = file("inc/".$_POST['table'].".fields");
$id=$_POST['id'];
foreach($fields as $ff){
$f=explode(" ",strtolower($ff));
$fn=str_replace("`","",$f[0]);
if($id){
if($f[0]!='`id`'){
if(strlen($sql)>0){
if($fn=='del_data'&&$new_data) $sql.=",";
else if($fn!='del_data') $sql.=",";
}
if($fn=='del_data'&&$new_data) $sql.=$f[0]."=";
else if($fn!='del_data')$sql.=$f[0]."=";
if($_POST[$fn]){
if(strpos($f[1],'archar')) {
if($fn=='pass')$sql.="'".md5(md5($_POST[$fn]).md5('salt'))."'";
else $sql.="'".$_POST[$fn]."'";
}
if(strpos($f[1],'loat')) $sql.="'".(floatval(str_replace(",",".",$_POST[$fn]))?floatval(str_replace(",",".",$_POST[$fn])):0)."'";
if(strpos($f[1],'nt')) {
if($_POST[$fn]=='on')$sql.="'1'";
else if($fn=='user_id')$sql.="'".$u['id']."'";
else $sql.="'".(intval($_POST[$fn])?intval($_POST[$fn]):0)."'";
}
if(strpos($f[1],'ate')) {
$sql.="'".$_POST[$fn]."'";
}
}
else if($fn=='user_id')$sql.="'".$u['id']."'";
else if(strpos($f[1],'nt')) $sql.="'0'";
else if(strpos($f[1],'loat')) $sql.="'0'";
else if(strpos($f[1],'archar')) $sql.="''";
else if(strpos($f[1],'ate')) {
if($fn!='del_data') $sql.="'".get_date()."'";
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
else {
if($f[0]=='`id`')$sql.="NULL";
else
{
if($_POST[$fn]){
if(strpos($f[1],'archar')) {
if($fn=='pass')$sql.=",'".md5(md5($_POST[$fn]).md5('salt'))."'";
else $sql.=",'".$_POST[$fn]."'";
}
else if(strpos($f[1],'loat')) $sql.=",'".(floatval(str_replace(",",".",$_POST[$fn]))?floatval(str_replace(",",".",$_POST[$fn])):0)."'";
else if(strpos($f[1],'nt')) {
if($_POST[$fn]=='on')$sql.=",'1'";
else $sql.=",'".(intval($_POST[$fn])?intval($_POST[$fn]):0)."'";
}
else if(strpos($f[1],'ate')) {
$sql.=",'".$_POST[$fn]."'";
}
}
else if($fn=='user_id')$sql.=",'".$u['id']."'";
else if(strpos($f[1],'nt')) $sql.=",'0'";
else if(strpos($f[1],'loat')) $sql.=",'0'";
else if(strpos($f[1],'archar')) $sql.=",''";
else if(strpos($f[1],'ate')) {
if($fn!='del_data') $sql.=",'".get_date()."'";
}
}
}
}
if(!$id)$sql="insert into `".$_POST['table']."` values(".$sql.")";
else $sql="update `".$_POST['table']."` set ".$sql." where `id`='$id'";
$ok=get_mysql_result($sql);
return $ok;
}
Стыдно, но нашел это в одном из первых проектов... :S
+242
proc HeapCompact(HANDLE hHeap, DWORD dwFlags)
mov edi, edi
push ebp
mov ebp, esp
pop ebp
jmp RtlCompactHeap
endp
Код от Microsoft. Заглушка? А вот и нет! Для заглушки нужны 5 байтов, а pop ebp останется на месте, т.е. при вызове вершина стека нарушится. Вот не могли просто NOP написать...