- 1
- 2
- 3
- 4
public function GetSubscriptions()
{
return $this->repaymentPay->check();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142
public function GetSubscriptions()
{
return $this->repaymentPay->check();
}
А я сказал горбатый!
+126
@echo off
chcp 1251
mygame.exe
chcp 866
Оттуда.
+81
procedure tmythread.execute;
procedure fillmemo;
begin
form1.memo1.lines.add('Some string');
end;
begin
synchronize(fillmemo); //[Error] Unit1.pas(54): There is no overloaded version of 'Synchronize' that can be called with these arguments
end;
Почему нельзя сделать вещи, сделанные "через анус", еще более "через анус"?
+74
List<CurrentRegion> currentRegionsFromDb = impl
.getAll(CurrentRegion.class);
if (currentRegionsFromDb.size() != 1) {
throw new FillReportException();
}
CurrentRegion currentRegion = (CurrentRegion) currentRegionsFromDb
.toArray()[0];
массив головного мозга
+70
protected void writeCaptionForDoubleColumns(HSSFWorkbook wb,
HSSFSheet sheet, HSSFRow row, HSSFCellStyle fulBorderCalignFont14,
Type1 obj1, Type2 obj2,
Type3 obj3, Type4 obj4, Type5 obj5,
Type6 obj6, Type7 obj7,
boolean writeObj6, boolean writeObj5,
boolean isHorizontal, String formName, String formNameCode) {
writeCaptionForDoubleColumns(wb, sheet, row, fulBorderCalignFont14,
obj1, obj2, obj3, obj4, obj5, obj6,
obj7, writeObj6, writeObj5, isHorizontal, formName,
formNameCode, true, null);
}
protected void writeCaptionForDoubleColumns(HSSFWorkbook wb,
HSSFSheet sheet, HSSFRow row, HSSFCellStyle fulBorderCalignFont14,
Type1 obj1, Type2 obj2,
Type3 obj3, Type4 obj4, Type5 obj5,
Type6 obj6, Type7 obj7,
boolean writeObj6, boolean writeObj5,
boolean isHorizontal, String formName, String formNameCode,
boolean nameFormCaption) {
writeCaptionForDoubleColumns(wb, sheet, row, fulBorderCalignFont14,
obj1, obj2, obj3, obj4, obj5, obj6,
obj7, writeObj6, writeObj5, isHorizontal, formName,
formNameCode, nameFormCaption, null);
}
описание может быть только матерным
+136
public int GetModuleId(int userId)
{
return moduleIdGet(userId);
}
protected int moduleIdGet(int userId)
{
int moduleId;
// calculate moduleId
// ...
return moduleId;
}
Дал открытый доступ, но в то же время как бы сохранил защищённый.
+120
removeTSdbTables(con, yesIknowWhatIamDoing=FALSE)
dropTStable(con, Table, yesIknowWhatIamDoing=FALSE)
The arument yesIknowWhatIamDoing defaults to FALSE and must be set to TRUE or the function will return an error.
http://www.inside-r.org/packages/cran/TSsql/docs/dropTStable
−121
private function taskResizer_resizeFinished(event:ResizerEvent):void {
var width:int = event.width;
var height:int = event.height;
task.changeSize(width, height);
// Wake up bindings
var zones:* = zones; // AHAHAHHAHAHA
this.zones = null;
this.zones = zones;
taskResizer.width = width;
taskResizer.height = height;
}
Апдейт биндингов и контрольный выстрел в (шестой) строке.
+155
try
{
return ($image = $this->row->image()->first())
? $image->{$this->imageAlias}
: dummyThumbnail($this->imageAlias)
;
}
catch(\Exception $e)
{
if ($e->getMessage() === 'Method [image] is not defined on the Query class.')
{
$val = parent::value();
return (is_string($val) and \Str::contains($val, 'http://'))
? $val
: $this->row->getImageSrc($this->name, $this->imageAlias)
;
}
throw new \Exception($e->getMessage(), $e->getCode());
}
+72
@Entity
public class MyObject {
@Column
private int type;
@Id
private long id;
@Column
private String name;
// и ещё другие поля, а также геттеры-сеттеры для них, в общем, обычная сущность
}
// managed bean в jsp 1.2 (legacy проект)
public class MyList {
private List<MyObject> oList;
private SimpleDateFormat filterDateFormat;
public MyList() {
filterDateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
}
public List<MyObject> getMyList() {
if (oList == null) {
oList = DAO.getDAO().findAllMyObjects();
String name = ...; // берётся из формы
if (name != null && name != "") {
oList = getObjectsByName(name, oList);
}
Integer type = ...; // тоже берётся из формы
if (type != null) {
oList = getObjectsByType(type, oList);
}
// и здесь ещё четыре куска такого же говнокода для других свойств MyObject
}
return oList;
}
private List<MyObject> getObjectsByType(Integer type, List<MyObject> oList) {
List<MyObject> queriesByType = new ArrayList<MyObject>();
for (MyObject o : oList) {
if (o.getType() == type) {
queriesByType.add(o);
}
}
return queriesByType;
}
private List<MyObject> getObjectsByName(String name, List<MyObject> oList) {
List<MyObject> queriesByName = new ArrayList<MyObject>();
for (MyObject o : oList) {
if (o.getName() == name) {
queriesByName.add(o);
}
}
return queriesByName;
}
// и ещё четыре таких же говнометода для других свойств MyObject
}
Наглядное руководство, как не надо работать с JPA