reduc_ind = list(xrange(1, len(x.get_shape())))
By Anonymous, 2017-08-14 18:37:29
function generateArrayFrom1To10()
{
    let a = 0;
    let b = 1;
    let c = 3;
    let d = 4;
    let e = 5;
    let f = 6;
    let g = 7;
    let h = 8;
    let i = 9;
    
    let array = [a,b,c,d,e,f,g,h,i];
    
    return array;
    
}
By Melon Tasters, 2019-07-11 18:06:38
const int ONLY_ONE_ITEM = 1;

if (myList.Count > ONLY_ONE_ITEM)
{
    DoSomething();
}
else
{
    DoSomethingElse();
}
By Anonymous, 2018-05-15 17:04:22
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
private HashMap<String, Tuple6<float[], String[], String[], String[], String[], String>> memberNameChangedToProtectTheInnocent = null;
By Anonymous, 2017-12-12 12:13:22
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
 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
 if (!String.IsNullOrEmpty(Client.CLADDR1))
            {
                if (Client.CLADDR1 == "NULL")
                {
By Anonymous, 2017-06-29 12:33:24
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
function edit_vehality: locality,
      google_place_id: '1'
    };
    let opts = { 'method': 'put', 'route': '/border/' + border_id, 'status': status, 'account_access_token': saved_values.superadmin.account_access_token, 'params': params };
    request(opts)
      .then(function(res) {
        resolve(res.result);
      }).catch(reject);
  })
}
By a poor soul, 2018-04-11 17:07:13
  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
return isDisabled == false ? false : true;
By Anonymous, 2018-03-23 22:02:31