let already_in = True;
while (already_in) {
    let random_index = Math.floor(arr.length * Math.random());
    let already_in = False;
    for (ex of exs) {
        if (ex.id === arr[random_index].id) {
            already_in = True;
        }
    }
}

Yes, this is JavaScript, and yes it didn't work. Found while reviewing some code

By L., 2021-05-17 11:20:12
if(!isset($obj->{'s5_4-1'})) {
	$obj->{'s5_4-1'} = 0;
}
if(!isset($obj->{'s5_4-2'})) {
	$obj->{'s5_4-2'} = 0;
}
if(!isset($obj->{'s5_4-3'})) {
	$obj->{'s5_4-3'} = 0;
}
if(!isset($obj->{'s5_4-4'})) {
	$obj->{'s5_4-4'} = 0;
}
By Anonymous, 2017-02-14 20:33:40
<?php

class CasinoCode
{
    CONST POST = 'POST';
    CONST GET = 'GET';
    
    $data = $this->callAPI('/hidden', [], self::POST);

production code of an API with dozens of millions of requests per day.

By Anonymous, 2019-10-17 19:43:24
    if [ $product == "consul" ]
    then
       aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
       unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
       rm   ${product}-enterprise_${version}+prem_linux_amd64.zip
    else
       aws s3 cp s3://${path}/${product}/prem/${version}/${product}-enterprise_${version}+prem_linux_amd64.zip .
       unzip ${product}-enterprise_${version}+prem_linux_amd64.zip
       rm   ${product}-enterprise_${version}+prem_linux_amd64.zip
    fi 
By Anonymous, 2019-10-22 15:10:43
    if (!recruiters
                    .stream().map(UserData::getUserName).collect(Collectors.toList())
                    .contains(recruiter.getUserData().getUserName())) {
    }
By somebody11, 2022-03-11 09:56:35
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
/**
 * Creates hash of client/customer password
 * @param string $password The actual password
 * @return string MD5 hash of password with salt
 */
public static function hashPassword($password)
{
	return md5($password . $password. 'SOME-SECRET-STRING' . $password);
}
By Anonymous, 2018-02-21 13:22:27
pageEndReached() {
      if (!this.endOfResults) {
        //load more pages
        this.page++;
        this.getPosts();
      followerCount: null,
      postCount: null,
      measurementKeys: ["a", "b", "c", "d", "e"],
      showDrafts: false,
    };
  },

nani

By sonic, 2021-06-08 22:52:01
socket.on('newMessage', (messageObj) => {
	if (roomNumber === messageObj.roomNumber) {

		console.log("message received:" + messageObj.message);
		$('#messages').append($('<li>').text(messageObj.userName + ' : ' + messageObj.message));

	}
});

socket.in wasn't behaving as advertised (broadcasting to all rooms). I decided to take matters into my own hands.

By Andrew, 2017-12-13 02:57:58
public class CustomBoolean {

    private Container<java.lang.Boolean> booleanContainer;

    public CustomBoolean(Container<Boolean> booleanContainer) {
        CustomBoolean custom_boolean = getThis();
        custom_boolean.booleanContainer = booleanContainer;
    }

    private <T extends Object> T getThis() {
        return (T) (Object) (T) this;
    }

    public Container<Boolean> getBooleanContainer() {
        return booleanContainer;
    }

    public static CustomBoolean create(Boolean value) {
        return new CustomBoolean(Container.builder().setValue(true).build());
    }

    public static void main(String[] args) {
        System.out.println(CustomBoolean.create(Boolean.TRUE).getBooleanContainer().getObject());
    }

    public static class Container<T extends Object> {

        private T object = null;

        private Container(T object) {
            Container<T> _this = getThis();
            _this.object = (T) (Object) object;
        }

        private <T extends Object> T getThis() {
            return (T) (Object) (T) this;
        }

        public static Builder builder() {
            return new Builder();
        }

        public T getObject() {
            return object;
        }

        public static class Builder<T extends Object> {
            private T value;

            public Builder<T> setValue(T value) {
                Container<T> _this = getThis();
                _this.object = (T) (Object) value;
                return this;
            }

            private <T extends Object> T getThis() {
                return (T) (Object) (T) this;
            }

            public Container build() {
                return new Container(value);
            }
        }
    }
} // Dort#0001

trolled

By Dort, 2022-03-24 21:41:54
case ClientMessage:    
    if (*XGetAtomName(GLWin.dpy, event.xclient.message_type)
        == *"WM_PROTOCOLS")
        {   printf("Exiting sanely...\n");
            done = True;
        }
    break;

someone just want to watch the world burn

By Anonymous, 2018-01-07 13:01:05
// We have this enum.
enum Formula {
  case proposition(String)
  indirect case negation(Formula)
  indirect case operation(op: String, lhs: Formula, rhs: Formula)

  var nnf: Formula { /* ... */  }
}

// And now ...

switch formula.nnf {
 case .proposition(_):
   return formula.nnf
 case .negation(_):
   return formula.nnf
 case .operation(_, _, _):
   return formula.nnf
}
By Anonymous, 2018-01-08 11:04:54
let verificaAdmin_Role = (req, res, next) => {

    let usuario = req.usuario;

    if (usuario.role === 'ADMIN_ROLE') {
        next();
    } else {
        return res.status(409).json({
            ok: false,
            err: {
                message: 'El usuario no es administrador.'
            }
        })
    }

};

By rootweiller, 2020-06-18 18:30:41
if (cookiesBannerHeight !== 0 && isMobile) {
      style = {
        top: cookiesBannerHeight === 0 ? 0 : cookiesBannerHeight
      }
}
By Kubus, 2018-02-28 11:00:11
const setFormFlag(state){
    state.formFlag ? state.formFlag = false : state.formFlag = true;
}
By Apeiron, 2018-07-27 20:43:23