//JSONObject input;
String givenName = input.get("propName") != null ? (String)input.get("propName") : null;
WHAT DA FUCK ASSHOLES
string AllPDF = "";
int CountPDF = 0;
AllPDF = txtInput.Text;
string[] AllPDF2 = AllPDF.Split(';');
List<string> PDF = new List<string>();
PDF.AddRange(AllPDF2);
while (PDF.Count != CountPDF)
{
File.Delete(AllPDF2[0 + CountPDF] + ".pdf");
CountPDF++;
}
I believe, there are so many easier ways to do that
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
if(userEndDate.getTime() != null
&& userEndDate.getTime() > today.getTime()
&& endDateFromRequest != null ? endDateFromRequest.getTime() !== userEndDate.getTime() : true){
//some code
}
for code lovers :D
int var = 0;
int* ptr = &var;
ptr[0] = 5;
std::cout << ptr[0];
export const getUniqueIds = (ids: string[]) => {
const uniqueIds = new Set<string>();
return ids.filter((id) => {
if (!uniqueIds.has(id)) {
uniqueIds.add(id);
return true;
}
return false;
});
};
String zeroPad(int number) {
return number < 10 ? "0" + number : String.valueOf(number);
}
You could just have done String.format("%02d", number);
switch (kafkaStreams.state()) {
case RUNNING: {
if (kafkaStreams.state().isRunning()) {
countDownLatch.countDown();
}
}
break;
$number = int(1);
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
<?php
// This code supposed to find adjacent items of a specific one
// $list is an array of ids
// $itemToSearch is an id that might be in the $list
foreach ($list as $item) {
next($list);
if ($item == $itemToSearch) {
break;
}
$previousItem = $item;
}
$nextItem = current($list);
The $list variable is a list of ids, e.g [1, 2, 3, 4, 5] The $itemToSearch is an id that might be in $list
public abstract class AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl {
private static AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl theOneAndOnlyInstance;
private Connection theUnbreakableEverlastingDatabaseLifeline;
public static AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl summonTheSingleton() {
if (theOneAndOnlyInstance == null) {
theOneAndOnlyInstance = new ConcreteImplementation();
}
return theOneAndOnlyInstance;
}
public abstract void initiateUnswervingDatabaseLinkWithCompulsiveRetriesAndUnyieldingTimeout();
public abstract InventoryProduct concoctAndJumpstartBrandNewInventoryProductPostRigorousValidation();
public abstract Service bootstrapAndEnrollNovelServicePostInfallibleAvailabilityCheck();
public abstract void seizeAndChronicleExceptionWithStackTrackAndSignalDeveloper(Exception e);
public abstract void manageAndFineTuneResourceConsumptionForPeakEfficiency(Resource resource);
public abstract void launchDatabaseTransactionWithOptimumIsolationLevel();
public abstract void ratifyDatabaseTransactionAndScourForPossibleConflicts();
public abstract void revokeDatabaseTransactionInEventOfUnforeseenErrors();
public abstract void safelySeverDatabaseConnectionAndLiberatePreciousResources();
}
maybeSomething match {
case Some(x) => true
case None => false
}
maybeSomething.getOrElse(false) Short code and readable
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);
})
}
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......