1. Список говнокодов пользователя vetal

    Всего: 3

  2. JavaScript / Говнокод #17998

    +165

    1. 1
    2. 2
    3. 3
    <% var telString = data.phone.toString(); %>
    <p class="mb0">Phone: <a class="mb0" itemprop="telephone" rel="dofollow"><%= "("+telString[0]+telString[1]+telString[2]+") "+telString[3]+telString[4]+telString[5]+"-"+telString[6]+telString[7]+telString[8]+telString[9] %></a></p>
    <% } %>

    data.phone - телефон в виде "0951112222".
    Нужно привести к виду (095)111-2222.

    vetal, 15 Апреля 2015

    Комментарии (48)
  3. Java / Говнокод #17814

    +79

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    builder.append(" SELECT ");
            for(int i=7;i>0;i--){            	
            	int month = cal.get(Calendar.MONTH) + 1;
                    int year = cal.get(Calendar.YEAR);
            	cal.add(Calendar.MONTH, -1);
            	builder.append(" IFNULL(SUM(IF((MONTH(FEED.feed_date)= "+ month +" && YEAR(FEED.feed_date)="+year+"),"+measurementByColumn+",0)),0) AS M"+i+ " , ");
            }
    builder.append(" IFNULL(MAX(IF((YEAR(FEED.feed_date)="+currentyear+" and FEED.feed_date=FEEDYEARDATA.curYearMaxFeedDate),"+measurementByColumn+",null)),0) AS CUR_YEAR_DATA, ");
    builder.append(" IFNULL(MAX(IF((YEAR(FEED.feed_date)="+lastyear+" and FEED.feed_date=FEEDYEARDATA.lastYearMaxFeedDate ),"+measurementByColumn+",null)),0) AS LAST_YEAR_DATA , ");
    builder.append(" FEED.pa_code,FEED.sub_pa_code ");
    builder.append(" FROM lm_dealer_info_data_feed FEED ");
    builder.append(" inner join ( SELECT pa_code,sub_pa_code, ");
    builder.append(" MAX(IF(YEAR(feed_date)="+currentyear+",feed_date,NULL)) as curYearMaxFeedDate, ");
    builder.append(" MAX(IF(YEAR(feed_date)="+lastyear+",feed_date,NULL)) as lastYearMaxFeedDate " );
    builder.append(" FROM lm_dealer_info_data_feed  " );
    builder.append(" GROUP BY pa_code,sub_pa_code  ) as FEEDYEARDATA " );
    builder.append(" ON FEED.pa_code =FEEDYEARDATA.pa_code and FEED.sub_pa_code = FEEDYEARDATA.sub_pa_code " );
    builder.append(" GROUP BY FEED.pa_code,FEED.sub_pa_code ");
    return builder.toString();

    Формируем чоткий запрос :)

    vetal, 18 Марта 2015

    Комментарии (15)
  4. Java / Говнокод #7861

    +93

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    <%if(myaccount.getCountry().equals( "AF" )){%> <font color="grey"><label for="country">Afghanistan</label></font>
        	<%}else if(myaccount.getCountry().equals( "AL" )){%> <font color="grey"><label for="country">Albania</label></font>
        	<%}else if(myaccount.getCountry().equals( "DZ" )){%> <font color="grey"><label for="country">Algeria</label></font>
        	<%}else if(myaccount.getCountry().equals( "AS" )){%> <font color="grey"><label for="country">American Samoa</label></font>
        	<%}else if(myaccount.getCountry().equals( "AD" )){%> <font color="grey"><label for="country">Andorra</label></font>
        	<%}else if(myaccount.getCountry().equals( "AO" )){%> <font color="grey"><label for="country">Angola</label></font>
        	<%}else if(myaccount.getCountry().equals( "AI" )){%> <font color="grey"><label for="country">Anguilla</label></font>
        	<%}else if(myaccount.getCountry().equals( "AQ" )){%> <font color="grey"><label for="country">Antarctica</label></font>
        	<%}else if(myaccount.getCountry().equals( "AG" )){%> <font color="grey"><label for="country">Antigua and Barbuda</label></font>
        	<%}else if(myaccount.getCountry().equals( "AR" )){%> <font color="grey"><label for="country">Argentina</label></font>
        	<%}else if(myaccount.getCountry().equals( "AM" )){%> <font color="grey"><label for="country">Armenia</label></font>
        	<%}else if(myaccount.getCountry().equals( "AW" )){%> <font color="grey"><label for="country">Aruba</label></font>
        	<%}else if(myaccount.getCountry().equals( "AU" )){%> <font color="grey"><label for="country">Australia</label></font>
        	<%}else if(myaccount.getCountry().equals( "AT" )){%> <font color="grey"><label for="country">Austria</label></font>
        	<%}else if(myaccount.getCountry().equals( "AZ" )){%> <font color="grey"><label for="country">Azerbaijan</label></font>
        	<%}else if(myaccount.getCountry().equals( "BS" )){%> <font color="grey"><label for="country">Bahamas</label></font>
            <%}else if ...

    Индусская проверка принадлежности аккаунта к определённой стране...

    P.S. Всё не влезло - стран у нас много =)

    vetal, 14 Сентября 2011

    Комментарии (15)