this.onSubmit = this.onSubmit.bind(this)
this.onClose = this.onClose.bind(this)
somewhere in react-native app
// 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
}
foreach ($desired_components as $name => $junk) {
list($component_value, $component_comments) = self::unpackPair($desired_components[$name]);
$desired_components[$name] = self::packPair(round($component_value, 2), $component_comments);
}
if ($customerId > 0) {
$customerId = $customerId;
} else {
$customerId = $this->customerSession->getId();
}
string random = "1";
$config = Config::getConfig('common');
$contract_carriers = $config[$market . "_" . $clearing . '_contract_carriers']; // f**ing php array
$interline_carriers = $config[$market . "_" . $clearing . '_interline_carriers']; // another f**ing array
// $marketing_carriers - is also array
$sets = [];
foreach ($marketing_carriers as $mc) {
$sets[] = array_unique(array_intersect(
array_merge(
[$mc],
array_intersect(
isset(self::$interlines[$mc]) ? self::$interlines[$mc] : [],
array_merge(
$marketing_carriers,
$interline_carriers
)
)
),
$contract_carriers
));
}
// What they did:
var serverCommands = {};
for(var each in commandList.general)
(dmCommands[commandList.general[each].type] ? dmCommands[commandList.general[each].type] +=
(config.prefix + each + (commandList.general[each].args ? ' ' + commandList.general[each].args : '') +
': ' + commandList.general[each].description + '\n') : (dmCommands[commandList.general[each].type] =
'\u200B'+ config.prefix + each + (commandList.general[each].args ? ' ' + commandList.general[each].args : '') +
': ' + commandList.general[each].description + '\n'))
// What they should've done:
let srvrCmds = new Map();
let gldCmds = commandList[message.guild.id];
for (let each in gldCmds) {
const cur = gldCmds[each];
const text = `${config.prefix + each + (cur.args ? " " + cur.args : "")}: ${cur.description}\n`;
const srvrCmdType = srvrCmds.get(cur.type);
srvrCmds.set(cur.type, (srvrCmdType || "\u200B") + text);
}
this.props.HeaderStore.setHeader(true, null, false, false, true, true,'dashboardNavigation');
if ( $ordinal_competitors > 0 ) {
foreach( $ordinal_bests as $label => $tuple ) {
unset( $waste[ $tuple['id']->{ '$id' } ] );
$essential[ $search_str ][ $tuple['stamp'] ][ $tuple['source'] ]['updated_at'] = $tuple['updated'];
$essential[ $search_str ][ $tuple['stamp'] ][ $tuple['source'] ]['proposals'][ $label ] = $tuple['price'];
$final_count ++;
}
}
function isAllowSearchLength(text) {
return text.length > isNaN(parseInt(text, 10)) ? 1 : 0;
}
if (isset(self::$proposals[$view])) {
$best_proposals = [];
$all_sources = [];
foreach (self::$proposals[$view] as $proposal_source => $proposal) {
if (!isset($this->backend_branch) || substr($this->backend_branch, 0, 11) != "adjust-for:" || substr($this->backend_branch, 11) == $proposal_source) {
if ($proposal['orig_base'] == $curr_base || $relax_checking) {
$age = time() - $proposal['updated_at'];
if ($age < self::MAX_AGE) {
foreach ($proposal['proposals'] as $proposal_label => $proposal_price) {
if (!in_array($proposal_label, [self::SK_LABEL_AVIASALES, self::SK_LABEL_SKYSCANNER, self::SK_LABEL_YANDEX, self::SK_LABEL_MOMONDO])) {
$proposal_key = $proposal_label;
if (!isset($best_proposals[$proposal_key]) || $best_proposals[$proposal_key]['price'] > $proposal_price) {
$best_proposals[$proposal_key] = [
'price' => $proposal_price,
'name' => $proposal_price . "@" . implode("~", array_map(function ($part) {
return preg_replace('/[~|=#@ ]/', '_', $part);
}, [
'label' => $proposal_label,
'source' => $proposal_source,
])),
'age' => $age,
];
$all_sources[$proposal_source] = null;
}
}
}
}
}
}
}
contracts = Contract.objects.filter(staff=staff).filter(active=True)
if contracts.__len__() > 0:
ind = contracts.__len__() - 1
dic[‘active_contract_id’] = contracts[ind].id
else:
dic[‘active_contract_id’] = contracts[0].id
Get last object of queryset in django
for x,x1 in enumerate(hack):
if hack[x] in letters:
exception +=1
ffs why
$guard = ($vars->a_payment) + (0) * $price;
if ($bless >= $guard) {
$amount = $bless;
}
Why not to write just 1 line?! $amount = max($bless, $vars->a_payment);
private static function derivePrice(...)
{
$price = self::derivePriceUnchecked($vars);
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
if (isset($price)) {
// CODE HERE
}
return $price;
}