this.unwatchBackdrop ? this.unwatchBackdrop() : this.noop();
...
private noop(): void {}
let True = true
let False = false
使用Python的 True 和 False 在javascript
date('Y-m-d').'T'.date("H:i:s", strtotime("- 1 hour")).'Z'
Back to the future
int min(int a,int b,int c) //Function to return the minimum.
{
if(a < b)
{
if(a < c)return a;
else if(a > c)return c;
else return a;
}
else if(a > b)
{
if(b < c)return b;
else if(b > c)return c;
else return b;
}
else
{
if(a < c) return a;
else if(a > c) return c;
else return a;
}
}
This kind of things make me hate my work.
def sho_est(request):
if not request.user.is_superuser and not request.user.is_staff and not request.user.is_university:
raise Http404
data = ''
if request.content_type == 'application/x-www-form-urlencoded' and request.method == 'POST':
user_detail = request.POST.get('user_detail', None)
if user_detail:
if request.user.is_superuser or request.user.is_staff:
credito = Credit.objects.get(pk=user_detail)
fecha_apronacion = 'Pendiente'
estado_firma = 'Pendiente'
estado_cuota = 'Pendiente'
if credito.created_at:
fecha_apronacion = credito.created_at.strftime('%Y-%m-%d')
if credito.is_iou_signed:
estado_firma = 'Firmado'
if credito.is_retainer_paid:
estado_cuota = 'Paga'
reg_amr_due = """
<tr style="border: 1px solid black; padding: 5px;">
<td style="border: 1px solid black; padding: 5px; text-align: right;">{period}</td>
<td style="border: 1px solid black; padding: 5px; text-align: right;">{due_amount}</td>
<td style="border: 1px solid black; padding: 5px; text-align: right;">{due_loan_amount}</td>
<td style="border: 1px solid black; padding: 5px; text-align: right;">
{due_tech_amount_due_surety_amount_due}</td>
<td style="border: 1px solid black; padding: 5px; text-align: right;">{due_interest_amount}</td>
<td style="border: 1px solid black; padding: 5px; text-align: right;">
{due_fines_arrears_amount_due_interest_arrears_amount}</td>
<td style="border: 1px solid black; padding: 5px; text-align: left;">{days_in_arrears}</td>
<td style="border: 1px solid black; padding: 5px; text-align: left;">{fullfilment_date}</td>
<td style="border: 1px solid black; padding: 5px; text-align: left;">{status}</td>
</tr>
"""
str_amr_due = ""
dic_ver = {}
Fuck Yeah
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
private static int alphabetToNumber(String letter) {
String s = letter.toLowerCase();
if (s.equals("a")) {
return 1;
} else if (s.equals("b")) {
return 2;
} else if (s.equals("c")) {
return 3;
} else if (s.equals("d")) {
return 4;
} else if (s.equals("e")) {
return 5;
} else if (s.equals("f")) {
return 6;
} else if (s.equals("g")) {
return 7;
} else if (s.equals("h")) {
return 8;
} else if (s.equals("i")) {
return 9;
} else if (s.equals("j")) {
return 10;
} else if (s.equals("k")) {
return 11;
} else if (s.equals("l")) {
return 12;
} else if (s.equals("m")) {
return 13;
} else if (s.equals("n")) {
return 14;
} else if (s.equals("o")) {
return 15;
} else if (s.equals("p")) {
return 16;
} else if (s.equals("q")) {
return 17;
} else if (s.equals("r")) {
return 18;
} else if (s.equals("s")) {
return 19;
} else if (s.equals("t")) {
return 20;
} else if (s.equals("u")) {
return 21;
} else if (s.equals("v")) {
return 22;
} else if (s.equals("w")) {
return 23;
} else if (s.equals("x")) {
return 24;
} else if (s.equals("y")) {
return 25;
} else if (s.equals("z")) {
return 26;
} else {
return 0;
}
}
var validAccountData = account.email != nil
validAccountData = account.firstName != nil
validAccountData = account.lastName != nil
if validAccountData {
return account
}
return nil
Proper validation
function IsAOrB(const p_Id: string): boolean;
begin
if ((p_Id = 'A') or (p_Id = 'B')) then begin
Result := true;
Exit;
end;
Result := false;
end;
Result := ((p_Id = 'A') or (p_Id = 'B'));
That would have been enough. But this also features Exit and an asymmetrical if.
if let _ = detailInformation {
loadDetailInformation()
}
when optionals are killing yourself
if ( x == true)
{
// do something
}
Fucking amateurs :| lol
$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
));
}
function isAllowSearchLength(text) {
return text.length > isNaN(parseInt(text, 10)) ? 1 : 0;
}
<input type="button" value="Go and fill later" onclick="javascript:window.location='<?php echo $url; ?>info.php'" />
Well, a is obsolete, let's do links as buttons!
if(
(!_.isEmpty($(switcher).val()) && value_isnt == ":empty") ||
((value_isnt) && !$(switcher).is(value_isnt) && value_isnt != ':empty') ||
(value_is && $(switcher).is(value_is) && value_is != ':empty') ||
(value_is == ':empty' && _.isEmpty($(switcher).val())) ||
(value && _switcherValue == value) ||
(valueIn && .anyMatchInArray(valueIn.split(','), .flatten([_switcherValue]))) ||
(valueOut && !.anyMatchInArray(valueOut.split(','), .flatten([_switcherValue])))
)