- 1
- 2
- 3
- 4
- 5
- 6
- 7
public static class BoolExt
{
public static string ToYesNoString(this bool value)
{
return value ? "Да" : "Нет";
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
public static class BoolExt
{
public static string ToYesNoString(this bool value)
{
return value ? "Да" : "Нет";
}
}
+144
$ git log --pretty=oneline
c8220f95d1b11d2e8a2d57cf4349c40a180bd7f3 Commit 33
6eeac872fa772c2ea1d57faf286f6520fc831777 Commit 32
fba42d3f0a6678e670d477bcc0c56819cafd34f9 Commit 31
4292c5dc9cb9c4360f7ad03b2d5ecabbeb451a55 Commit 30
2ba640394371f0fd44296c41b99fd42f6abfaf95 Commit 29
80aa4d6754e5f82f3b111075747fd74f63e1a26c Commit 28
7f43aa08d9d94e6c09f6435635942010320a824e Commit 27
574524bf2b0dcb8070ce46ced75cec626e7c84ad Commit 26
eb620063a690c489e746e2f5633771da66df0903 Commit 25
...
https://github.com/gikraychik/bets
+144
// Класс валидации в PrestaShop
class ValidateCore
{
...
public static function isIp2Long($ip)
{
return preg_match('#^-?[0-9]+$#', (string)$ip);
}
public static function isAnything()
{
return true;
}
...
+144
public String tommorowCalendarCountry(String date, String country){
String tommorowCountry = null;
if(date.equals(getTommorow())){
tommorowCountry = country;
}
return tommorowCountry;
}
public String tommorowCalendarIndicator(String date, String indicator){
String tommorowIndicator = null;
if(date.equals(getTommorow())){
tommorowIndicator = indicator;
}
return tommorowIndicator;
}
public String tommorowCalendarImportance(String date, String importance){
String tommorowImportance = null;
if(date.equals(getTommorow())){
tommorowImportance = importance;
}
return tommorowImportance;
}
public String tommorowCalendarForecast(String date, String forecast){
String tommorowForecast = null;
if(date.equals(getTommorow())){
tommorowForecast = forecast;
}
return tommorowForecast;
}
public String tommorowCalendarPrevious(String date, String previous){
String tommorowPrevious = null;
if(date.equals(getTommorow())){
tommorowPrevious = previous;
}
return tommorowPrevious;
}
public String tommorowCalendarActual(String date, String actual){
String tommorowActual = null;
if(date.equals(getTommorow())){
tommorowActual = actual;
}
return tommorowActual;
}
public String tommorowCalendarDescription(String date, String description){
String tommorowDescription = null;
if(date.equals(getTommorow())){
tommorowDescription = description;
}
return tommorowDescription;
}
public String tommorowCalendarPeriod(String date, String period){
String tommorowPeriod = null;
if(date.equals(getTommorow())){
tommorowPeriod = period;
}
return tommorowPeriod;
}
public String tommorowCalendarLocation(String date, String location){
String tommorowLocation = null;
if(date.equals(getTommorow())){
tommorowLocation = location;
}
return tommorowLocation;
}
пришло с аутсорса. Такого в проекте очень много)
+144
// ====================== БОЛЬШОЕ Спасибо разработчикам архитектуры FzMobile (GI Center)=====================
// =============================== Очень удобно трэкать пурчейсы через вьюшку ================================
// Почему бы и не заинитить вьюшку на статическом контексте.
/* final FzView fzView = new FzView(sRelatedApplication);
// Тут мы тупо дадим отдохнуть процесору,
// и понадеемся, что во время отдыха их сервис все тами, каким то чудом, поднимется.
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
FzController fzController = null;
for (int i = 0 ; i < 4; i++){ // Паттерн "настойчивость(с)" был взаимствован непосредственно из их архитектуры.
fzController = fzView.getController();
}
try{ // а тут может и пиздануться.
final float fPrice = price/100f;
fzController.savePayment(id, "gbp", fPrice, "gbp", fPrice); // даже и не спрашивайте что это за дублирование....
}catch (Throwable t){
t.printStackTrace();
}
}
},555*//*а почему бы и нет*//*);*/ // - слава Аллаху, мы выпилили эту хуету!
//==============================================================================================
+144
Unit Web;
interface
uses System, System.Drawing, System.Windows.Forms;
var f: Form;
type
WebBro = class(Form)
procedure button1_Click(sender: Object; e: EventArgs);
{$region FormDesigner}
private
{$resource Web.WebBro.resources}
button1: Button;
webBrowser1: WebBrowser;
{$include Web.WebBro.inc}
{$endregion FormDesigner}
public
constructor;
begin
InitializeComponent;
end;
end;
implementation
Procedure FindForm();
begin
var i:=0;
while i < Application.OpenForms.Count do
begin
f := Application.OpenForms.Item[i];
if f.Name = 'TwiGen_News' then exit
else inc(i);
end;
end;
procedure WebBro.button1_Click(sender: Object; e: EventArgs);
begin
WebBro.ActiveForm.Hide();
FindForm;
f.Show();
end;
end.
//----------------
Unit Unit1;
interface
uses System, System.Drawing, System.Windows.Forms, Web;
var NewsForm: WebBro;
type
TwiGen_News = class(Form)
procedure News_Click(sender: Object; e: EventArgs);
{$region FormDesigner}
private
{$resource Unit1.TwiGen_News.resources}
LogIn: Button;
News: Button;
Reg: Button;
{$include Unit1.TwiGen_News.inc}
{$endregion FormDesigner}
public
constructor;
begin
InitializeComponent;
end;
end;
implementation
procedure TwiGen_News.News_Click(sender: Object; e: EventArgs);
begin
TwiGen_News.ActiveForm.Hide();
NewsForm := new WebBro;
NewsForm.Show;
end;
end.
Друг писал, но мне он говорил, что переписывал говнокод.
Pascal ABC.NET.
+144
$testing[$i]['ddate'] = ((substr("$departureDate", 0, -4)) . "/" . (substr("$departureDate", -4, 2)) . "/" . (substr("$departureDate", -2))) . "(" . ((substr("$departureTime", 0, -2)) . ":" . (substr("$departureTime", -2))) . ")";
$testing[$i]['adate'] = ((substr("$arrivalDate", 0, -4)) . "/" . (substr("$arrivalDate", -4, 2)) . "/" . (substr("$arrivalDate", -2))) . "(" . ((substr("$arrivalTime", 0, -2)) . ":" . (substr("$arrivalTime", -2))) . ")";
из реального проекта, который писал индус.
форматирование даты. это все еще и в цикле
+144
function timeToSec($date){
$timeToSec = 0;
$month_to_days = array(1=>0,2=>31,3=>59,4=>90,5=>90,6=>151,7=>181,8=>212,9=>243,10=>273,11=>304,12=>334);
$year = intval(substr($date, 0, 4));
$month = intval(substr($date, 5, 2));
$day = intval(substr($date, 8, 2));
$hover = intval(substr($date, 11, 2));
$minute = intval(substr($date, 14, 2));
$second = intval(substr($date, 17, 2));
$timeToSec+= ($year-1 - ($year-1)%4)/4 * 24 * 60 * 60 + ($year-1) * 355 * 24 * 60 * 60;
$timeToSec+= $month_to_days[$month] * 24 * 60 * 60;
if($year%4==0 && $month>2){
$timeToSec+= 24 * 60 * 60;
}
$timeToSec+= ($day-1) * 24 * 60 * 60;
$timeToSec+= $hover * 60 * 60;
$timeToSec+= $minute * 60;
$timeToSec+= $second;
return $timeToSec;
}
просто смотрел проекты прошлого программера....
+144
10 MEDIAN=0
15 FOR Q=1 TO 10000 REM Lifes
20 TOTAL=0 REM Money
25 FOR I=1 TO 100
30 M=RND
35 IF M<0.5 THEN N=INT(10*RND)
40 IF M>=0.5 THEN N=-INT(10*RND)
45 TOTAL=TOTAL+N
50 NEXT I
55 MEDIAN=MEDIAN+TOTAL
60 PRINT Q,"MEDIAN="MEDIAN/Q
65 NEXT Q
GW-BASIC
"Жизнь по генератору случайных чисел: стратегия успеха"
автор: Евгений Золотов
+144
if ((int)$qty && ((int)$qty > 0)) {
OpenCart