- 1
- 2
- 3
- 4
- 5
- 6
- 7
if (_viewModel.ShowColumnChooser && _viewModel.UseDefaultColumnChooser)
//...
else {
if (!_viewModel.ShowColumnChooser)
return;
//...
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
if (_viewModel.ShowColumnChooser && _viewModel.UseDefaultColumnChooser)
//...
else {
if (!_viewModel.ShowColumnChooser)
return;
//...
}
Сэмпл платного фреймворка Syncfusion. Да, на этом коде они объясняют, как использовать их классы. А в поддержке отвечают сплошные косноязычные Раджеши Кутрапалли.
+2
public void Initiaize(long buffersCount, int bufferSize)
{
if (bufferSize > Int32.MaxValue)
{
throw new ArgumentOutOfRangeException("bufferSize", bufferSize,
"Buffers size can't be grater than Int32 max value");
}
_bufferSize = bufferSize;
}
+2
.section-cart .table .th1.th1,
.section-cart .table .th2.th1,
.section-cart .table .th3.th1,
.section-cart .table .th4.th1 {
width: 575px;
}
.section-cart .table .th1.th2,
.section-cart .table .th2.th2,
.section-cart .table .th3.th2,
.section-cart .table .th4.th2 {
width: 285px;
}
.section-cart .table .th1.th3,
.section-cart .table .th2.th3,
.section-cart .table .th3.th3,
.section-cart .table .th4.th3 {
width: 250px;
}
.section-cart .table .th1.th1,
.section-cart .table .th2.th2,
.section-cart .table .th3.th3,
.section-cart .table .th4.th4 {
width: 250px;
}
.section-cart .table .td1,
.section-cart .table .td2,
.section-cart .table .td3,
.section-cart .table .td4,
.section-cart .table .td5,
.section-cart .table .td6 {
display: inline-block;
vertical-align: middle;
height: 215px;
border-bottom: 1px solid #d1d1d1;
}
.section-cart .table .td1.td1,
.section-cart .table .td2.td1,
.section-cart .table .td3.td1,
.section-cart .table .td4.td1,
.section-cart .table .td5.td1,
.section-cart .table .td6.td1 {
width: 245px;
line-height: 215px;
text-align: center;
}
.section-cart .table .td1.td1 img,
.section-cart .table .td2.td1 img,
.section-cart .table .td3.td1 img,
.section-cart .table .td4.td1 img,
.section-cart .table .td5.td1 img, {
.section-cart .table .td5.td1 img {
display: inline-block;
vertical-align: middle;
}
.section-cart .table .td1.td2,
.section-cart .table .td2.td2,
.section-cart .table .td3.td2,
.section-cart .table .td4.td2,
.section-cart .table .td5.td2 {
padding-left: 30px;
line-height: 215px;
padding-right: 25px;
width: 355px;
}
.section-cart .table .td1.td2 > span,
.section-cart .table .td2.td2 > span,
.section-cart .table .td3.td2 > span,
.section-cart .table .td4.td2 > span,
.section-cart .table .td5.td2 > span {
line-height: normal;
display: inline-block;
vertical-align: middle;
}
.section-cart .table .td1.td2 .title,
.section-cart .table .td2.td2 .title,
.section-cart .table .td3.td2 .title,
.section-cart .table .td4.td2 .title,
.section-cart .table .td5.td2 .title {
color: #181415;
font-size: 22px;
padding-bottom: 20px;
}
.section-cart .table .td1.td2 .opts,
.section-cart .table .td2.td2 .opts,
.section-cart .table .td3.td2 .opts,
.section-cart .table .td4.td2 .opts,
.section-cart .table .td5.td2 .opts {
font-size: 16px;
color: #636363;
line-height: 24px;
}
.section-cart .table .td1.td2 .opts b,
.section-cart .table .td2.td2 .opts b,
.section-cart .table .td3.td2 .opts b,
.section-cart .table .td4.td2 .opts b,
.section-cart .table .td5.td2 .opts b {
display: inline-block;
padding-right: 10px;
color: #181415;
}
Вот так вот строим обычную табличку.
+2
public int Add(T item)
{
var p = m_parent as DataTreeRecord;
var i = item as DataTreeRecord;
if (m_newData == null || m_newData.Length == 0) m_newData = new T[8];
if (m_newData.Length <= m_newCount) Array.Resize(ref m_newData, m_newData.Length * 2);
if (p != null && i != null)
{
i.Parent = p;
}
m_newData[m_newCount++] = item;
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, new T[1] { item }));
return this.Count - 1;
}
Мы любим ебаться с array. List? Зачем, он медленный! Мы напишем свой ORM с аррэями и PHP внутри няшного сишарпика.
Приходилось работать с этим проектом. Это просто кладезь говнокода, и это ещё не самое ужасное место.
+2
....iv>'.(isset($row['add_descr']) ? $row['add_descr']:'').'</td....
угу, в реальном сайте, который на нашей (говно)поддержке
+2
public interface ICachedObject<TCachedValue>
{
TCachedValue Value { get; set; }
}
public interface ICacheProvider<TCachedObject, TCachedValue>
where TCachedObject : ICachedObject<TCachedValue>
{
TCachedObject Get(string key);
void Set(string key, TCachedObject value);
void Remove(string key);
IEnumerable<TCachedObject> GetAll();
}
public class CachedEntityObject : ICachedObject<IEntity>
{
public EntityState State { get; set; }
public IEntity Value { get; set; }
}
public abstract class CacheProvider<TCache, TCachedObject, TCachedValue> :
ICacheProvider<TCachedObject, TCachedValue>
where TCache : IDictionary<string, TCachedObject>
where TCachedObject : ICachedObject<TCachedValue>
{
protected TCache Cache;
protected abstract void InitializationCache();
public abstract TCachedObject Get(string key);
public abstract void Set(string key, TCachedObject value);
public abstract void Remove(string key);
public abstract IEnumerable<TCachedObject> GetAll();
}
public class CacheEntity : CacheProvider<Dictionary<string, CachedEntityObject>, CachedEntityObject, IEntity>
{
public CacheEntity()
{
InitCache();
}
protected sealed override void InitCache()
{
Cache = new Dictionary<string, CachedEntityObject>();
}
public override CachedEntityObject Get(string key)
{
if (Cache[key] == null)
throw new NullReferenceException($"{nameof(key)} not found from cache list");
return Cache[key];
}
public override void Set(string key, CachedEntityObject value)
{
Remove(key);
Cache[key] = value;
}
public override void Remove(string key)
{
if (Cache.ContainsKey(key))
Cache.Remove(key);
}
public override IEnumerable<CachedEntityObject> GetAll()
{
return Cache.Values;
}
}
Кэш сущностей
+2
public function extractPublicPlace($item)
{
list($a['name'], list($a['lat'], $a['lon'])) = $item;
return $a;
}
просто оставлю
+2
applications_menu_container.find('a').click(function () {
if ($(this).parent('.disabled').length === 0 || $(this).parent('.active').length === 0) {
applications_menu_container.find('li').removeClass('active');
$(this).parent().addClass('active');
switch ($(this).attr('id')) {
case 'active_applications':
applications_history_container.hide();
applications_history_pagination_toolbar.hide();
application_add_container.hide();
active_applications_sub_menu.hide();
change_application_sub_container.hide();
application_history_sub_container.hide();
application_files_sub_container.hide();
applications_history_sub_menu.hide();
historical_application_history_sub_container.hide();
historical_application_files_sub_container.hide();
load_active_applications(0, 10);
break;
case 'applications_history':
active_applications_container.hide();
active_applications_bottom_toolbar.hide();
application_add_container.hide();
active_applications_sub_menu.hide();
change_application_sub_container.hide();
application_history_sub_container.hide();
application_files_sub_container.hide();
applications_history_sub_menu.hide();
historical_application_history_sub_container.hide();
historical_application_files_sub_container.hide();
load_applications_history(0, 10);
break;
case 'new_application':
default:
active_applications_container.hide();
active_applications_bottom_toolbar.hide();
applications_history_container.hide();
applications_history_pagination_toolbar.hide();
active_applications_sub_menu.hide();
change_application_sub_container.hide();
application_history_sub_container.hide();
application_files_sub_container.hide();
applications_history_sub_menu.hide();
historical_application_history_sub_container.hide();
historical_application_files_sub_container.hide();
show_add_application_form();
break;
}
}
return false;
});
Переключение вкладок.
+2
https://habrahabr.ru/post/280121/
RestAPI в 2016 году. Отсосите, любители фреймворков и оттестированных библиотек
+2
/**
* @brief Макрос вызова функции изменения имени файла лога ПИМ
*
* @param FILE_NAME Имя файла лога
*
* @return Ничего
*/
#define LOG_PIM_SET_FILE_NAME(FILE_NAME) Soc::setLogFileName(FILE_NAME)
Самый нужный макрос в мире