- 1
this.xlWorkSheet.get_Range("V" + (i + 3).ToString(), Missing.Value).Value2 = Convert.ToDouble(sample_info.Rows[i]["id"].ToString().Replace(Program.separator, Program.new_separator));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+135
this.xlWorkSheet.get_Range("V" + (i + 3).ToString(), Missing.Value).Value2 = Convert.ToDouble(sample_info.Rows[i]["id"].ToString().Replace(Program.separator, Program.new_separator));
Классика. Меняем точку на запятую.
+152
if(isset($_GET['do'])){
$page = $checkObj->pageCheck($_GET['dopage']);
$incModules = 'staticpage';
if($link_set['on_news_post_html'] == 1){
$nameLinkPost = $checkObj->pageCheck($_GET['dopage']);
if($nameLinkPost != ''){
$tmp_id_post = explode('_',$_GET['dopage']);
$id_post = $checkObj->idCheck($tmp_id_post[0]);
$nameLinkPost = $checkObj->pageCheck($tmp_id_post[1]);
if(($id_post) and (!empty($tmp_id_post[1]))){
$incModules = 'post';
$page = '';
}
}
}
}
Так нормально?
+68
private Date value;
private SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
private SimpleDateFormat sdfshort = new SimpleDateFormat("dd.MM.yyyy");
void setValue(String value) {
try {
if (value.length() >= 18)
this.value = sdf.parse(value);
else
this.value = sdfshort.parse(value);
} catch (ParseException e) {
this.value = sdfshort.parse(value);
}
}
+17
// base class for objects that need to be initialized
//
struct Initializable
{
protected:
inline void OneTimeInit()
{
#if _DEBUG_BUILD
ASSERT(!m__hasBeenIsInitialized);
m__hasBeenIsInitialized = true;
#endif // _DEBUG_BUILD
}
inline void OneTimeDestroy()
{
#if _DEBUG_BUILD
ASSERT(m__hasBeenIsInitialized);
m__hasBeenIsInitialized = false;
#endif // _DEBUG_BUILD
}
inline void CheckInitialized()
{
#if _DEBUG_BUILD
mxBREAK_IF( !m__hasBeenIsInitialized );
#endif // _DEBUG_BUILD
}
inline Initializable()
{
#if _DEBUG_BUILD
m__hasBeenIsInitialized = false;
#endif // _DEBUG_BUILD
}
inline ~Initializable()
{
#if _DEBUG_BUILD
ASSERT(!m__hasBeenIsInitialized);
#endif // _DEBUG_BUILD
}
private:
#if _DEBUG_BUILD
bool m__hasBeenIsInitialized;
#endif // _DEBUG_BUILD
};
template< class KLASS > // where KLASS : TGlobal<KLASS>, Initializable
struct DependsOn
{
protected:
DependsOn()
{
ASSERT( KLASS::HasInstance() );
ASSERT( KLASS::Get().IsInitialized() );
}
};
template< class KLASS > // where KLASS : TGlobal<KLASS>
struct DependsOnGlobal
{
protected:
DependsOnGlobal()
{
ASSERT( KLASS::HasInstance() );
//ASSERT( KLASS::Get().IsInitialized() );
}
};
Базовый класс для дебажной проверки того, был ли инициализирован конкретный объект.
Этот бред находился в самой древней кодобазе, сейчас нигде не используется. Удаляю.
+156
<?php
$dataProvider = new CActiveDataProvider('User', array(
'criteria'=>array(
'condition' => 'id = ' . $id,
),
));
$regdata = $dataProvider->getData();
if (is_array($regdata)) $regdata = current($regdata);
//....
$this->redirect(Yii::app()->createUrl('user/profile'));
Как не стоит писать на Yii
+156
if($(".picture-column.gallery").size()) {
$(".minigal-nav .counter").text("1 из " + $(".picture-column.gallery").find("li").size());
if (window.isWindowsPhone){
$(".minigal-nav li.next").attr("onclick", 'var index = $(".picture-column.gallery li.current").index(); index++; if(index > $(".picture-column.gallery").find("li").size() - 1) {index = 0;};switchImage(index);');
$(".picture-column.gallery img").attr("onclick", '$(".minigal-nav li.next").trigger("click");');
$(".minigal-nav li.prev").attr("onclick", 'var index = $(".picture-column.gallery li.current").index();index--;if(index < 0) {index = $(".picture-column.gallery").find("li").size() - 1;};switchImage(index);');
} else {
$(".minigal-nav li.next").on("click", function() {
var index = $(".picture-column.gallery li.current").index();
index++;
if(index > $(".picture-column.gallery").find("li").size() - 1) {
index = 0;
}
switchImage(index);
});
$(".picture-column.gallery img").on("click", function() {
$(".minigal-nav li.next").trigger("click");
});
$(".minigal-nav li.prev").on("click", function() {
var index = $(".picture-column.gallery li.current").index();
index--;
if(index < 0) {
index = $(".picture-column.gallery").find("li").size() - 1;
}
switchImage(index);
});
}
var switchImage = function(index) {
$(".picture-column.gallery li.current").fadeOut(function() {
$(this).removeClass("current");
$(".picture-column.gallery").find("li").eq(index).fadeIn().addClass("current");
});
$(".minigal-texts li.current").fadeOut(function() {
$(this).removeClass("current");
$(".minigal-texts").find("li").eq(index).fadeIn().addClass("current");
});
$(".minigal-nav .counter").text(index + 1 + " из " + $(".picture-column.gallery").find("li").size());
}
}
Это что-то типа адаптивный слайдер))))
−123
# remove whole directory to avoid bugs like rm -rf ""/*
rm -rf "$CHROOT_DIR"
mkdir -p "$CHROOT_DIR"
Вспомнилось bumblebee
+141
"C++" - говно для говна.
+157
$infopage = file_get_contents("http://instagram.com/api/v1/users/".$match."/info/", false, $context);
$isprivate = substr($infopage,strpos($infopage,',"is_private":')+14,strpos($infopage,',"external_url":"')-strpos($infopage,',"is_private":')-14);
$fullname = substr($infopage,strpos($infopage,'","full_name":"')+15,strpos($infopage,'","follower_count":')-strpos($infopage,'","full_name":"')-15);
$mediacount = substr($infopage,strpos($infopage,',"media_count":')+15,strpos($infopage,',"following_count":')-strpos($infopage,',"media_count":')-15);
$following = substr($infopage,strpos($infopage,',"following_count":')+19,strpos($infopage,',"geo_media_count":')-strpos($infopage,',"following_count":')-19);
$isint2 = is_numeric($following);
if ($isint2 == false){$following = substr($infopage,strpos($infopage,',"following_count":')+19,strpos($infopage,',"profile_pic_url":"')-strpos($infopage,',"following_count":')-19);}
$followers = substr($infopage,strpos($infopage,',"follower_count":')+18,strpos($infopage,',"pk":')-strpos($infopage,',"follower_count":')-18);
$avatar = stripslashes(substr($infopage,strpos($infopage,'"profile_pic_url":"')+19,strpos($infopage,'","biography":"')-strpos($infopage,'"profile_pic_url":"')-19));
$bio = substr($infopage,strpos($infopage,'","biography":')+15,strpos($infopage,'","full_name":"')-strpos($infopage,'","biography":')-15);
$website = stripslashes(substr($infopage,strpos($infopage,'"external_url":"')+16,strpos($infopage,'"}}')-strpos($infopage,'"external_url":"')-16));
$countq = mysql_query("SELECT COUNT(*) FROM `links` WHERE `ownerID` = '".$match."'");
$countf = mysql_fetch_array($countq);
Парсинг API Instagram. JSON - слишком неправославно, да.
+151
$s = $this->getAdapter()->select()->from(array('b' => $this->info('name'), array(
'text',
'link',
'image',
'show_register',
)))->joinInner(array('s' => 'banner_size'), 's.id=b.size_id', array('x', 'y'))
->where('b.show_it = ?', 1)
->where('s.x = ?', $sizeX)
->where('s.y = ?', $sizeY)
->limit(1)
->order('RAND()');
if (!empty($uid)){
$s->where('(b.show_register= ?, 1)' OR '(b.show_register= ?, 0)');
} else {
$s->where('(b.show_register= ?, -1)' OR '(b.show_register= ?, 0)');
}
echo $s-> __toString();
// var_dump(!empty($uid));
return $this->getAdapter()->fetchRow($s);
мега крутое условие
$s->where('(b.show_register= ?, 1)' OR '(b.show_register= ?, 0)');