- 1
 
http://www.crunchzilla.com/code-maven
                                    Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+362
http://www.crunchzilla.com/code-maven
                                    Визуальная новелла по манге JS
+267
//форма собственности
	$('#sobst').change(function(){
		var $radiouch = $('#uchred1, #uchred2');
		var valip = 'ИП';
		var $ip = $('#ip').attr('id');
		var $obsch = $('.obschestvo').attr('class');
		var $obsch2 = $('.obschestvo2').attr('class');
		if($('option:selected', this).attr('id')==$ip){
			$tab24.fadeOut(500);
			$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('required').removeClass('err').attr('disabled','');
            $tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
			$radiouch.prop('checked', false);
			$novalid.removeAttr('required');  
		}
		if($('option:selected', this).attr('class')==$obsch){
			if($('#i').prop("checked")){
				$tab24.fadeOut(500);
				$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('required').removeClass('err').attr('disabled','');
                $tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
				$radiouch.prop('checked', false);
                $novalid.removeAttr('required');
			}
			else{
				$tab24.fadeIn(1000);
				$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('disabled').removeClass('err').attr('required','');
                $tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
				$radiouch.prop('checked', false);
                $novalid.removeAttr('required');
			}
		}
		if($('option:selected', this).attr('class')==$obsch2){
			if($('#i').prop("checked")){
				$tab24.fadeOut(500);
				$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('required').removeClass('err').attr('disabled','');
                $tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
				$radiouch.prop('checked', false);
			}
			else{
				$tab24.fadeIn(1000);
				$tab24.find('input[type!=button][type!=submit], select, #Opis').removeAttr('disabled').removeClass('err').removeAttr('required','');
                $tab24.find('input[type!=button][type!=submit][type!=radio], select, #Opis').val('');
				$radiouch.prop('checked', false);
			}
		}
	});
	
	//Выбор учредителя
	$('#uchrdiv1').find("input[type='radio']").click(function(){
        var $dopuchr = $('#Familia, #Imia, #Otchestvo, #Dola');
		var $uchr2elem = $('#uchrdiv2').find('input[type!=button][type!=submit][type!=radio], select, #Opis');
		var $rad = $(this).attr('id');
		if($rad==$('#uchred2').attr('id')){
			$("#labfio").text("Форма собственности *");
			$("#labname").text("Наименование *");
			$("#labsur").text("УНП *");
			$("#zagolovok").text("Наименование учредителя *");
			$uchr2elem.removeAttr('required').removeClass('err').attr('disabled','');
			$('#surname1').attr('required','');
            $('#uchred1').removeClass('err');
            $dopuchr.removeAttr('required');
		}
		else {
			$("#labfio").text('Фамилия *');
			$("#labname").text("Имя *");
			$("#labsur").text("Отчество");
			$("#zagolovok").text("Ф.И.О учредителя в именительном падеже *");
			$uchr2elem.removeAttr('disabled').attr('required','').val('');
            $('#table2').find('input[type!=radio]').removeAttr('disabled').attr('required','');
			$('#surname1, #pomeschenieNum3').removeAttr('required','');
            $('#uchred2').removeClass('err');
            $dopuchr.removeAttr('required');
		}
	});
	
	//Способ получения
	$('.forms5').find("input[type='radio']").click(function(){
		var $grd = $('#grd').find('input[id!=pomeschenieNum6], select');
		var $ofs = $('#ofs').find('input, select');
		var $posrad = $(this).attr('id');
		if($posrad==$('#Ofis').attr('id')){
			$grd.removeAttr('required').removeClass('err').attr('disabled','').val('');
			$ofs.removeAttr('disabled').attr('required','').val('');
            $('#Viezd').removeAttr('required').removeClass('err');
            $('#Ofis').attr('required');
		}
		if($posrad==$('#Viezd').attr('id')){
			$ofs.removeAttr('required').removeClass('err').attr('disabled','').val('');
			$grd.removeAttr('disabled').attr('required','').val('');
            $('#Ofis').removeAttr('required').removeClass('err');
            $('#Viezd').attr('required');
		}
	});
	
	//кнопка submit
	$('#otpravit').on({
        mousedown: function(){
            $(this).css('background','linear-gradient(to bottom right, #D77024, #E49656)');
        }, 
        mouseup: function(){
            $(this).css('background','linear-gradient(to bottom right, #EC841C, #EDA24E)');
                                    
            страница с формами
название файла (ВНИМАНИЕ!): dubische_gaz
        
−682
CREATE FUNCTION this_function_check_first_payment_under_agreement_without_previous_periods
(
....
                                    Ну вот сразу всё понятно)
+322
void worker(int id)
{
    while (true) {
        std::unique_lock<std::mutex> lock(connPoolMutex);
        connPoolCond.wait(lock, [] { return !connectionsPool.empty(); });
        ClientConnection conn = connectionsPool.front();
        connectionsPool.pop();
        lock.unlock();
        TCPSocket sock(conn);
        sock.setReadTimeout(READ_TIMEOUT);
        char buffer[MAX_PACKET_LEN] = {};
        int sz = sock.recv(buffer, sizeof(buffer));
        // [...]
    }
}
// [...]
int main()
{
    // [...]
    TCPSocket server("0.0.0.0:1234");
    server.bind();
    server.listen(1000);
    while (true) {
        ClientConnection conn = server.accept();
        std::unique_lock<std::mutex> l(connPoolMutex);
        connectionsPool.push(conn);
        connPoolCond.notify_one();
    }
}
                                    
            Современный, многопоточный и масштабируемый сервер на C++!
TCPSocket - очень тонкая обёртка над голым сокетом.
        
+119
<?php header('Content-Type: application/rss+xml'); ?>
<?='<?xml version="1.0" encoding="utf-8"?>'?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title><![CDATA[Neon Genesis Kode]]></title>
    <link>http://govnokod.ru</link>
    <description><![CDATA[Свежие комментарии]]></description>
    <pubDate><?=date(DATE_RSS)?></pubDate>
    <language>ru-ru</language>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>3600</ttl>
<?php
$curl_context = curl_init(); 
curl_setopt($curl_context, CURLOPT_URL, 'http://146.185.130.46/ngk/api/v1/latest'); 
curl_setopt($curl_context, CURLOPT_RETURNTRANSFER, 1); 
$raw_data = curl_exec($curl_context); 
curl_close($curl_context);     
$data = JSON_decode($raw_data);
foreach($data as $item) { ?>
  <item>
      <title><![CDATA[Комментарий к говнокоду #<?=$item->thread_id?>]]></title>
      <link>http://govnokod.ru/<?=$item->thread_id?>#comment<?=$item->comment_id?></link>
      <guid>http://govnokod.ru/<?=$item->thread_id?>#comment<?=$item->comment_id?></guid>
      <description><![CDATA[<?=$item->text?>]]></description>
      <pubDate><?=date(DATE_RSS, strtotime($item->posted))?></pubDate>
  </item>
<?php } ?>
</channel>
</rss>
                                    Обычный пыхокод. Листайте дальше.
+320
import java.io.*;
public class word {
	static int count = 0;
public static void main (String[] args)throws IOException{
	BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	String word = reader.readLine();
	reader.close();
	String r = word.replaceAll("\\d|\\s|\\\\|/|\\]|\\[|\\`|\\~|\\.|\\>|\\<|\\,|\\;|\\:|\\\"|\\'|\\||\\?|\\!|\\@|\\#|\\№|\\$|\\%|\\^|\\&|\\*|\\)|\\(|\\-|\\_|\\+|\\=|\\}|\\{","");
	char[] letters = r.toCharArray();
	
	for(int i = 0;i<letters.length;i++){
		count++;
	
	}
	System.out.println("Кол-во букв:" + count);
}
}
                                    программа считывает кол-во букв в слове, которое вводит юзер
+14
public class DooBeeDooBeeDo {
	public static void main(String[] args){
		
		int x = 1;
		while(x<3){
			
			System.out.print("Doo");
			System.out.print("Bee");
			x=x+1;
		}
		if(x==3){
			System.out.print("Do");
		}
		
		
	}
}
                                    одно из старых упражнений
+270
$("#page1").click(function(){
					$(".ag1").fadeIn(2500);
					});
					$("#page2").click(function(){
					$(".ag2").fadeIn(2500);
					});
					$("#page3").click(function(){
					$(".ag3").fadeIn(2500);
					});
					$("#page4").click(function(){
					$(".ag4").fadeIn(2500);
					});
					$("#page5").click(function(){
					$(".ag5").fadeIn(2500);
					});
					$("#page6").click(function(){
					$(".ag6").fadeIn(2500);
					});
					$("#page7").click(function(){
					$(".ag7").fadeIn(2500);
					});
					$("#page8").click(function(){
					$(".ag8").fadeIn(2500);
					});
					$("#page9").click(function(){
					$(".ag9").fadeIn(2500);
					});
					$("#page10").click(function(){
					$(".ag10").fadeIn(2500);
					});
					$("#page11").click(function(){
					$(".ag11").fadeIn(2500);
					});
					$("#page12").click(function(){
					$(".ag12").fadeIn(2500);
					});
					$("#page13").click(function(){
					$(".ag13").fadeIn(2500);
					});
					$("#page14").click(function(){
					$(".ag14").fadeIn(2500);
					});
					$("#page15").click(function(){
					$(".ag15").fadeIn(2500);
					});
					$("#page16").click(function(){
					$(".ag16").fadeIn(2500);
					});
					$("#page17").click(function(){
					$(".ag17").fadeIn(2500);
					});
					$("#page18").click(function(){
					$(".ag18").fadeIn(2500);
					});
					$("#page19").click(function(){
					$(".ag19").fadeIn(2500);
					});
					$("#page20").click(function(){
					$(".ag20").fadeIn(2500);
					});
					$("#page21").click(function(){
					$(".ag21").fadeIn(2500);
					});
					$("#page22").click(function(){
					$(".ag22").fadeIn(2500);
					});
					$("#page23").click(function(){
					$(".ag23").fadeIn(2500);
					});
					$("#page24").click(function(){
                                    Из Азербайджана с любовью.
+319
if (("/dir/" + TXT_FILE_NAME).equals(fileName))
	processTxtFiles(TXT_FILE_NAME);
else if (fileName.endsWith(TXT_FILE_NAME))
	processTxtFiles(TXT_FILE_NAME);
else if ...
                                    Зачем первые две строки?
+317
/**
     * 连接指定的手环
     *
     * @param callback
     */
    public void connect(BluetoothDevice device, final ActionCallback callback) {
        this.io.connect(context, device, callback);
    }
    public void setDisconnectedListener(NotifyListener disconnectedListener) {
        this.io.setDisconnectedListener(disconnectedListener);
    }
    /**
     * 和手环配对, 实际用途未知, 不配对也可以做其他的操作
     *
     * @return data = null
     */
    public void pair(final ActionCallback callback) {
        ActionCallback ioCallback = new ActionCallback() {
            @Override
            public void onSuccess(Object data) {
                BluetoothGattCharacteristic characteristic = (BluetoothGattCharacteristic) data;
                Log.d(TAG, "pair result " + Arrays.toString(characteristic.getValue()));
                if (characteristic.getValue().length == 1 && characteristic.getValue()[0] == 2) {
                    callback.onSuccess(null);
                } else {
                    callback.onFail(-1, "respone values no succ!");
                }
            }
            @Override
            public void onFail(int errorCode, String msg) {
                callback.onFail(errorCode, msg);
            }
        };
        this.io.writeAndRead(Profile.UUID_CHAR_PAIR, Protocol.PAIR, ioCallback);
    }
    public BluetoothDevice getDevice() {
        return this.io.getDevice();
    }
    /**
     * 读取和连接设备的信号强度RSSI值
     *
     * @param callback
     * @return data : int, rssi值
     */
    public void readRssi(ActionCallback callback) {
        this.io.readRssi(callback);
    }
    /**
     * 读取手环电池信息
     *
     * @return {@link BatteryInfo}
     */
    public void getBatteryInfo(final ActionCallback callback) {
        ActionCallback ioCallback = new ActionCallback() {
            @Override
            public void onSuccess(Object data) {
                BluetoothGattCharacteristic characteristic = (BluetoothGattCharacteristic) data;
                Log.d(TAG, "getBatteryInfo result " + Arrays.toString(characteristic.getValue()));
                if (characteristic.getValue().length == 10) {
                    BatteryInfo info = BatteryInfo.fromByteData(characteristic.getValue());
                    callback.onSuccess(info);
                } else {
                    callback.onFail(-1, "result format wrong!");
                }
            }
            @Override
            public void onFail(int errorCode, String msg) {
                callback.onFail(errorCode, msg);
            }
        };
        this.io.readCharacteristic(Profile.UUID_CHAR_BATTERY, ioCallback);
    }
    /**
     * 让手环震动
     */
    public void startVibration(VibrationMode mode) {
        byte[] protocal;
        switch (mode) {
            case VIBRATION_WITH_LED:
                protocal = Protocol.VIBRATION_WITH_LED;
                break;
            case VIBRATION_10_TIMES_WITH_LED:
                protocal = Protocol.VIBRATION_10_TIMES_WITH_LED;
                break;
            case VIBRATION_WITHOUT_LED:
                protocal = Protocol.VIBRATION_WITHOUT_LED;
                break;
            default:
                return;
        }
                                    @chineesedoc