switch ($content) {
    case "vid":
      echo '<iframe width="600" height="450" src="http://www.youtube.com/embed/' . $img . '" frameborder="0" allowfullscreen></iframe>';
      break;
    default:
      if ($height > 0 && $width > 0) {
        echo '<img width="' . $width . '" height="' . $height . '" src="http://szpileczki.com/up/' . $img . '"/>';
      } else {
        if ($kochamto == 1) {
          echo '<img src="http://kocham.to/up/' . $img . '"/>';
        } else {
          echo '<img src="http://szpileczki.com/up/' . $img . '"/>';
        }
      }
      break;
 }

especially if one of them doesn't exist since 2012

By Anonymous, 2016-11-19 14:54:36
from typing import Dict, List

from dataclasses import dataclass
from lbcore.orders import Order, Match


@dataclass
class SideEffect:
    order_id: str = ''
    action: Dict = None
    updates: Dict = None
    matches: List[Match] = None
    order: Order = None
    action_exists: bool = False

    def match(self, price):
        match = self.action.copy()
        match['price'] = price
        return match


class SideEffects(list):
    def add_action(self, order, action_exists=False, **action):
        action['order_id'] = order.id
        se = SideEffect(order=order, action=action,
                        action_exists=action_exists)
        self.append(se)
        return se

    def add_update(self, order_id, **updates):
        se = SideEffect(order_id=order_id, updates=updates)
        self.append(se)
        return se

    def add_trade(self, order, matches):
        se = SideEffect(order=order, matches=matches)
        self.append(se)
        return se
By Anonymous, 2019-07-18 13:24:21
String zeroPad(int number) {
  return number < 10 ? "0" + number : String.valueOf(number);
}

You could just have done String.format("%02d", number);

By Anonymous, 2022-04-30 10:50:20
public class MandateData {

    public final UUID coreId;
    public final UUID accountId;
    public final String accountRef;
    public final String creditorId;
    public final String creditorName;
    public final String debtorFirstName;
    public final String debtorLastName;
    public final String branchCode;
    public final String accountNumber;
    public final LocalDate signingDate;
    public final Address debtorAddress;

    private MandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
                        LocalDate signingDate, Address debtorAddress) {
        this.coreId = coreId;
        this.accountId = accountId;
        this.accountRef = accountRef;
        this.creditorId = creditorId;
        this.creditorName = creditorName;
        this.debtorFirstName = debtorFirstName;
        this.debtorLastName = debtorLastName;
        this.branchCode = branchCode;
        this.accountNumber = accountNumber;
        this.signingDate = signingDate;
        this.debtorAddress = debtorAddress;
    }

    public static MandateData creationMandateData(UUID coreId, UUID accountId, String accountRef, String creditorId, String creditorName, String branchCode, String accountNumber, String debtorFirstName, String debtorLastName,
                                                  LocalDate signingDate, Address debtorAddress) {
        return new MandateData(coreId, accountId, accountRef, creditorId, creditorName, branchCode, accountNumber, debtorFirstName, debtorLastName, signingDate, debtorAddress);
    }
}

There is an ancient and mysterious legend about public static constructor, called createShit. If anyone want's just to create an instance of Shit be aware of it! This is too obvious! just Implement static method with the exactly the same fields, and make constructor private. Don't write a shit!

By Anonymous, 2018-06-07 13:03:44
	const ws = new WebSocket('wss://echo.websocket.org', {
		agent: new HttpsProxyAgent(`https://${proxy}`)
	});
	wsz.push(ws);
	ws.onopen = () => {
		if (ws.readyState === WebSocket.OPEN) {
			.....
			ws.close();
		}
	};
	ws.onerror = () => {
		ws.close();
	};

u just cant trust, just cant......

By Neon, 2018-10-23 18:14:26
maybeSomething match {
  case Some(x) => true
  case None => false
}

maybeSomething.getOrElse(false) Short code and readable

By Majid Hosseini, 2017-12-16 07:03:07
const newReply = (reply !== null) ? reply : null;
By foxy, 2018-06-04 21:19:27
reduc_ind = list(xrange(1, len(x.get_shape())))
By Anonymous, 2017-08-14 18:37:29
def even?(number)
  if number > 0
    result = number
  else
    result = -number
  end

  while result > 2 or result == 2
    result = result - 2
  end

  if result == 0
    true
  else
    false
  end
end

Best solution to find out if a number is even.

By Anonymous, 2023-11-12 14:59:07
const int ONLY_ONE_ITEM = 1;

if (myList.Count > ONLY_ONE_ITEM)
{
    DoSomething();
}
else
{
    DoSomethingElse();
}
By Anonymous, 2018-05-15 17:04:22
this.onSubmit = this.onSubmit.bind(this)
this.onClose = this.onClose.bind(this)

somewhere in react-native app

By fluttershy, 2018-01-08 08:01:40
 if (!String.IsNullOrEmpty(Client.CLADDR1))
            {
                if (Client.CLADDR1 == "NULL")
                {
By Anonymous, 2017-06-29 12:33:24
    public static String arrayToString(List list) {
        if (list == null) {
            throw new IllegalArgumentException("list is null");
        }
        return list.toString()
                .replace("[", "")  //remove the right bracket
                .replace("]", "")  //remove the left bracket
                .trim();
    }
By Anonymous, 2023-07-30 00:29:07
  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
 private void EnableGPSAutoMatically() {
        GoogleApiClient googleApiClient = null;
        if (googleApiClient == null) {
            oogleApiClient = new GoogleApiClient.Builder(this)
                    .addApi(LocationServices.API).addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this).build();
            /* about 50 lines of code were here ... 
             * all depends on this if statement ... !
             * Actually the whole method depends on this if statement ! */
                    }
                }
            });
        }
}

what if that mysterious power change it to be not null !! It gonna be a holly object and You should not "new" it anymore ?! damn ... :)))

By Anonymous, 2018-03-28 11:31:15