[HttpPost]
[Route("validaPrepacks")]
public IHttpActionResult ValidaPrepacks(ValidaPrepackVO validacion)
{
try
{
return Ok();
}
catch (Exception e)
{
return Ok(e.Message);
}
}
A code that "validate" a pack in the backend
boolean darkModeSelected = (!darkModeSelected ? true : false);
@Pipe({ name: 'shortSex' })
export class SexPipe implements PipeTransform {
public transform(value: any): 'M' | 'K' {
switch (value?.code) {
case SexCodes.MALE:
return 'M';
case SexCodes.FEMALE:
return 'K';
default:
return null;
}
}
}
What can I say more?
i++;
i++;
i++;
i++;
Console.WriteLine(i);
He doesn't know what is " i+=4 " :||||
public void updateCurrency() {
LOGGER.info("Update currencies");
var ok = false;
try {
getExchangeRatesMechanism(getExchangeRatesProcessor());
ok = true;
} catch (Exception exception) {
LOGGER.error(exception.getMessage(), exception);
}
if (ok) {
LOGGER.info("The currencies were updated successfully!");
}
}
public event EventHandler<Cles_graph_doivent_etre_redessines> les_graph_doivent_etre_redessines;
public void remove_event()
{
if (this.les_graph_doivent_etre_redessines != null)
{
foreach (EventHandler<Cles_graph_doivent_etre_redessines> F_les_graph_doivent_etre_redessines in this.les_graph_doivent_etre_redessines.GetInvocationList())
{
this.les_graph_doivent_etre_redessines -= F_les_graph_doivent_etre_redessines;
}
}
}
$command = 'curl -X GET -H "application/json" -H "X-Api-Key: '.$key.'" https://some-api.com/resource';
exec($command, $output);
$array = json_decode($output[0], true);
Using curl in PHP is boring. Let execute a command for
public showOrHideLegends(seriesList: any[]) {
if (seriesList.length === 0)
return false;
else
return true;
}
more code lines => more money; that's how our contractor company thinks
function downScaleCanvas(a, b) {
var c = Math.ceil,
d = Math.floor;
if (!(1 > b) || !(0 < b)) throw "scale must be a positive number <1 ";
var e = b * b,
f = a.width,
g = a.height,
h = d(f * b),
i = d(g * b),
j = 0,
k = 0,
l = 0,
m = 0,
n = 0,
o = 0,
p = 0,
q = 0,
r = 0,
s = 0,
t = 0,
u = 0,
v = 0,
x = 0,
y = 0,
z = !1,
A = !1,
B = a.getContext("2d").getImageData(0, 0, f, g).data,
C = new Float32Array(3 * h * i),
D = 0,
E = 0,
F = 0;
for (k = 0; k < g; k++)
for (n = k * b, r = 0 | n, o = 3 * r * h, A = r != (0 | n + b), A && (x = r + 1 - n, y = n + b - r - 1), j = 0; j < f; j++, l += 4) m = j * b, q = 0 | m, p = o + 3 * q, z = q != (0 | m + b), z && (u = q + 1 - m, v = m + b - q - 1), D = B[l], E = B[l + 1], F = B[l + 2], z || A ? z && !A ? (s = u * b, C[p] += D * s, C[p + 1] += E * s, C[p + 2] += F * s, t = v * b, C[p + 3] += D * t, C[p + 4] += E * t, C[p + 5] += F * t) : A && !z ? (s = x * b, C[p] += D * s, C[p + 1] += E * s, C[p + 2] += F * s, t = y * b, C[p + 3 * h] += D * t, C[p + 3 * h + 1] += E * t, C[p + 3 * h + 2] += F * t) : (s = u * x, C[p] += D * s, C[p + 1] += E * s, C[p + 2] += F * s, t = v * x, C[p + 3] += D * t, C[p + 4] += E * t, C[p + 5] += F * t, t = u * y, C[p + 3 * h] += D * t, C[p + 3 * h + 1] += E * t, C[p + 3 * h + 2] += F * t, t = v * y, C[p + 3 * h + 3] += D * t, C[p + 3 * h + 4] += E * t, C[p + 3 * h + 5] += F * t) : (C[p] += D * e, C[p + 1] += E * e, C[p + 2] += F * e);
var G = document.createElement("canvas");
G.width = h, G.height = i;
var H = G.getContext("2d"),
I = H.getImageData(0, 0, h, i),
J = I.data,
K = 0;
for (l = 0, p = 0; K < h * i; l += 3, p += 4, K++) J[p] = c(C[l]), J[p + 1] = c(C[l + 1]), J[p + 2] = c(C[l + 2]), J[p + 3] = 255;
return H.putImageData(I, 0, 0), G
}
dohhhhhh !!
var doc = (Parent as Doc);
doc.Name = (doc != null) ? "" : doc.Name
$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
));
}
private void reset_kolejnosc()
{
this.kolejnosc_s[0] = 1;
this.kolejnosc_s[1] = 2;
this.kolejnosc_s[2] = 3;
this.kolejnosc_s[3] = 4;
this.kolejnosc_s[4] = 5;
this.kolejnosc_s[5] = 6;
this.kolejnosc_s[6] = 7;
this.kolejnosc_s[7] = 8;
this.kolejnosc_s[8] = 9;
this.kolejnosc_s[9] = 10;
}
const ITEM_COUNT = 100
let visibleItems = []
for (let i = 0; i < ITEM_COUNT; ++i) {
visibleItems.push(false)
}
function showItem(index) {
visibleItems = []
for (let i = 0; i < ITEM_COUNT; ++i) {
visibleItems.push(false)
}
visibleItems[index] = true
}
It was more or less like this. The guy had a collection of React components and wanted to show only one of them at a time. Instead of storing the index of the component to show at the moment, he decided that a boolean array would work much better. O(n) in runtime and space and null readability just because.
$partnerChargesRegular = $row['charges'];
$partnerChargesIrregular = $row['charges'];
if (!isset($partnerChargesIrregular) || $partnerChargesIrregular == "") {
$partnerChargesIrregular = $partnerChargesRegular;
}
Look. We take A from X and B from X. Then, you make a check, and if it is true you assing A to B. BUT A AND B ARE TAKEN FROM THE SAME X PLACE!!! HOW CAN THEY DIFFER?!?!!!?!?!?!?!!
self.isOptionsVisible = ko.computed(function() {
if((self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isNameVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isBeforeAfterImagesVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isTooltipVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isLabelVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload') || (self.type() == 'info')) {
return true;
}
return false;
}, this);
self.isClassVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isStyleVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
object orientation overrated. let's check the fields in several places ...