if (argv[1][0]=='D'){
                demo=1;
                argv[1]++;
        }

        if (argv[1][0]=='P'){
                if (sscanf(argv[1], "P%ux%ux%ux%ux%lfx%ux%u"
                                ,&temporal_resample
                                ,&input_w, &input_h, &rate, &input_gamma
                                ,&output_w
                                ,&output_h)!=7){
                        fprintf(stderr,"%s: Invalid argument format\n", progname);
                        print_usage();
                        exit(3);
                }
                ppm=1; 
         }else{
                if (sscanf(argv[1], "%ux%ux%ux%ux%lfx%ux%u"
                                ,&temporal_resample
                                ,&input_w
                                ,&input_h
                                ,&rate
                                ,&input_gamma
                                ,&output_w
                                ,&output_h)!=7){
                        fprintf(stderr,"%s: Invalid argument format\n", progname);
                        print_usage();
                        exit(3);
                }

Found in a chroma subsampling algorithm.

By Anonymous, 2021-03-18 19:51:47
let foo = {} // object no. 1
let bar = {} // object no. 2

foo > bar // return false
foo < bar // return false, so maybe foo equals bar?
foo == bar // oh well, return false
// but
foo >= bar // return true, 'cause !(foo < bar) == true

return value is expected, but JS is funny

By Anonymous, 2021-03-12 21:08:32
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

Never, ever define developer environment and debug as default thing! #pdk

By kadet, 2021-03-08 23:28:18
int w = 100;

for (nil; w!=0; nil) {

    w -= 1;

    //so some shit
}

this code was found in chinese contract work

By JeanetteMueller, 2021-03-08 11:58:39
public enum DataSize {
    BYTE,
    DOUBLE_BYTE,
    INT,
    LONG;
    
    public boolean isEqualTo(Object value) {
        if(value instanceof Byte && this.equals(BYTE)) {
            return true;
        } else if ((value instanceof Character || value instanceof Short) && this.equals(DOUBLE_BYTE)) {
            return true;
        } else if ((value instanceof Integer) && this.equals(INT)) {
            return true;
        } else if ((value instanceof Long) && this.equals(LONG)) {
            return true;
        }
        return false;
    }
}
By DevHONK, 2021-02-22 15:21:03
String s = "string";

String.valueOf(s).toString();

// just to make sure it's a damn string
while(!s instanceof String) {
    String.valueOf(s).toString();
}
By Anonymous, 2021-01-23 17:11:10
if (isset($data['phone_id']) && !empty($data['phone_id'])) {
    $userPhone = $this->getDoctrine()->getRepository('STODBBundle:Phones')->find($data['phone_id']);
    if ($userPhone->getPhoneNumber() != $data['phone'] || $userPhone->getMobileProviderCode()->getId() != $data['phone_code']) {
        if ($data['smsCode'] ?? false) {
            if ($sessionSmsCode !== $data['smsCode']) {
                $aData['smsCodeShow'] = false;
                $aData['isWrongCode'] = true;
            } else {
                $aData['isWrongCode'] = false;
                $checkCode = $data['smsCode'];
            }
        } else {
            $aData['smsCodeShow'] = true;
            $aData['isWrongCode'] = true;
        }
    } elseif (!$userPhone->getCodeCheck()) {
        if ($data['smsCode'] ?? false) {
            if ($sessionSmsCode !== $data['smsCode']) {
                $aData['smsCodeShow'] = false;
                $aData['isWrongCode'] = true;
            } else {
                $aData['isWrongCode'] = false;
                $checkCode = $data['smsCode'];
            }
        } else {
            $aData['smsCodeShow'] = true;
        }
    } else {
        $aData['isWrongCode'] = false;
    }
} else {
    if ($data['smsCode'] ?? false) {
        if ($sessionSmsCode !== $data['smsCode']) {
            $aData['smsCodeShow'] = false;
            $aData['isWrongCode'] = true;
        } else {
            $aData['isWrongCode'] = false;
            $checkCode = $data['smsCode'];
        }
    } else {
        $aData['smsCodeShow'] = true;
    }
}

shit ... this junior

By sergma33, 2020-12-23 15:30:45
    self.isOptionsVisible = ko.computed(function() {
        if((self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isNameVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isBeforeAfterImagesVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isTooltipVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isLabelVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload') || (self.type() == 'info')) {
            return true;
        }

        return false;
    }, this);

    self.isClassVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

    self.isStyleVisible = ko.computed(function() {
        if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
            return true;
        }

        return false;
    }, this);

object orientation overrated. let's check the fields in several places ...

By Dude, 2020-12-16 12:25:17
// check if user is valid or not
ValidUserValidationResult userValidationResult = validUserValidator.validateUser(validationRequest);
By Anonymous, 2020-12-09 17:45:18
if (!response ||
    !response.data ||
    !response.data.success ||
    response.data.success == false ) {
        //process stuff
}

Not talking about the '===' warning, here

By Anonymous, 2020-12-02 12:31:00
  if(!Hardware::initialize()) {
    Serial.println("Hardware initialization failed!");
    for(;;){}
  }

  if(!UI.begin()) {
    Serial.println("SSD1306 allocation failed");
    for(;;){}
  }

For is best ever, why even bother with While, or even Return... Source of code: https://github.com/MausTec/nogasm-wifi/blob/master/ESP32_WiFi.ino

By Anonymous, 2020-11-22 20:05:34
<?php
if(!defined('WPINC')) // MUST have WordPress.
	exit ('Do not access this file directly.');
	
	if(!class_exists('pluginName_options_page_class'))
{
	/**
	 * Menu page blah
	 *
	 * @package blah
	 * @since 140617
	 */
	class pluginName_options_page_class
	{
		public function __construct()
		{
			echo '<div class="wrap menu-page">'."\n";

			echo '<div class="wp-header-end"></div>'."\n";

			echo '<div class="menu-page-toolbox">'."\n";
			pluginName_some_other_class::display();
			echo '</div>'."\n";

			echo '<h2>Options</h2>'."\n";

			echo '<table class="menu-page-table">'."\n";
			echo '<tbody class="menu-page-table-tbody">'."\n";
			echo '<tr class="menu-page-table-tr">'."\n";
			echo '<td class="menu-page-table-l">'."\n";

			echo '<form method="post" name="plugin_options_form" id="plugin--options-form" autocomplete="off">'."\n";
			echo '<input type="hidden" name="plugin_options_save" id="plugin--options-save" value="'.esc_attr(wp_create_nonce('plugin--options-save')).'" />'."\n";

			echo '<div class="menu-page-group" title="Account Details">'."\n";
			
			/* includes things like this gem */
			echo (!is_multisite() || !pluginName_utils_conds::is_multisite_farm() || is_main_site()) ? '<p>[ Really Long message about something ]</p>'."\n" : '';

			/* ... continues until end ... */

			echo '</div>'."\n";
		}
	}
}

new pluginName_options_page_class ();

The entire file is a single class with a constructor. The constructor is ~ 1150 lines of echo statements with a few PHP conditionals thrown in. There are no other methods. The class is instantiated as soon as it is defined. Clever...

By Anonymous, 2020-11-10 06:08:16
def get_verified_infos(request):
    try:
        # request logic here
        return data
    except Exception:
        logger.error(
            'Request to XXX was unsuccessful, '
            'Will retry till max recursion! Retrying...'
        )
        return get_verified_infos(request)

Used for OpenID authentication

By Anonymous, 2020-11-04 18:28:11
try {
    synchronized(this) {
        Object obj = null;

        if (obj.hashCode() == -1) {
            obj = new Object();
        }
    }
} catch (Throwable t) {
    throw t;
} finally {
    try {
        synchronized(this) {
            Object obj = null;

            if (obj.hashCode() == -1) {
                obj = new Object();
            }
        }
    } catch (Throwable t) {
        throw t;
    } finally {
        try {
            synchronized(this) {
                Object obj = null;

                if (obj.hashCode() == -1) {
                    obj = new Object();
                }
            }
        } catch (Throwable t) {
            throw t;
        } finally {
            System.exit(1);
        }
    }
}

Cool code

By Conclure, 2020-10-30 02:26:02
  <div ng-repeat="recipient in $ctrl.resource.invoiceRecipients track by $index">
    <div>
      {{$ctrl.resource.invoiceRecipients[$index]}}
    </div>
  </div>

You could easily use the "recipient" variable instead of getting it again from the array, is there a reason for doing this?

By Anonymous, 2020-10-29 16:26:16