@register.filter
def rangocinco(obj_id, limit):
if (obj_id+5) > limit:
if not (limit-4) == obj_id:
# print((limit-4), obj_id, flush=True)
return range((limit-4), (limit+1))
else:
# print('SI NO', flush=True)
return range((obj_id-2), (obj_id+3))
else:
# print('NO', flush=True)
if (obj_id-4) < 2:
# print('NO SI', flush=True)
return range(obj_id, (obj_id+5))
else:
# print('NO NO', flush=True)
return range((obj_id-4), (obj_id+1))
Fuck
/// <summary>
/// Desctop constructor
/// </summary>
...
This is best XML commentary I found so far.
#include <stdio.h>
#include<stdlib.h>
#include<time.h>
void randy(int array[] ){
int i = 0 , d = 0;
for(i = 1 ; i <= 23 ; i++){
array[i] = 1 + (rand() % 365 );
}
}
int compare (const void * a, const void * b)
{
return ( *(int*)a - *(int*)b );
}
int find (int arr[]){
int d = 0;
for(d = 1 ;d <=23 ; d++ ){
if(arr[d] == arr[d + 1]){
return 1;
}
}
return 0;
}
int main(void){
double count_birthday = 0;
int people[24];
srand(time(NULL));
int c = 0 ;
long double ip = 0;
while(ip++ <= 1000000 ){
randy(people);
qsort (people, 25, sizeof(int), compare);
if(find (people) == 1 ){
count_birthday++;
}
}
printf("%.2lf", count_birthday / 10000 );
return 0;
}
int getChar(char charachter){
int returnValue = Z;
switch(charachter){
case 'A': returnValue = A; break;
case 'a': returnValue = A; break;
case 'B': returnValue = B; break;
case 'b': returnValue = B; break;
case 'C': returnValue = C; break;
case 'c': returnValue = C; break;
case 'D': returnValue = D; break;
case 'd': returnValue = D; break;
case 'E': returnValue = E; break;
case 'e': returnValue = E; break;
case 'F': returnValue = F; break;
case 'f': returnValue = F; break;
case 'G': returnValue = G; break;
case 'g': returnValue = G; break;
case 'H': returnValue = H; break;
case 'h': returnValue = H; break;
case 'I': returnValue = I; break;
case 'i': returnValue = I; break;
case 'J': returnValue = J; break;
case 'j': returnValue = J; break;
case 'K': returnValue = K; break;
case 'k': returnValue = K; break;
case 'L': returnValue = L; break;
case 'l': returnValue = L; break;
case 'M': returnValue = M; break;
case 'm': returnValue = M; break;
case 'N': returnValue = N; break;
case 'n': returnValue = N; break;
case 'O': returnValue = O; break;
case 'o': returnValue = O; break;
case 'P': returnValue = P; break;
case 'p': returnValue = P; break;
case 'Q': returnValue = Q; break;
case 'q': returnValue = Q; break;
case 'R': returnValue = R; break;
case 'r': returnValue = R; break;
case 'S': returnValue = S; break;
case 's': returnValue = S; break;
case 'T': returnValue = T; break;
case 't': returnValue = T; break;
case 'U': returnValue = U; break;
case 'u': returnValue = U; break;
case 'V': returnValue = V; break;
case 'v': returnValue = V; break;
case 'W': returnValue = W; break;
case 'w': returnValue = W; break;
case 'X': returnValue = X; break;
case 'x': returnValue = X; break;
case 'Y': returnValue = Y; break;
case 'y': returnValue = Y; break;
case 'Z': returnValue = Z; break;
case 'z': returnValue = Z; break;
case ' ': returnValue = _; break;
case '3': returnValue = B2; break;
case '<': returnValue = TEMP; break;
case '*': returnValue = FULL; break;
case '|': returnValue = LINE; break;
case '_': returnValue = _; break;
case ':': returnValue = COL; break;
case '-': returnValue = DASH; break;
case ')': returnValue = BRA2; break;
case '%': returnValue = SMILE; break;
case '.': returnValue = DOT; break;
case '^': returnValue = COLDOT; break;
}
return returnValue; //RETORNO DE INFORMAÇÃO
}
found on brazillian website
public function update($oldVersion) {
switch ($oldVersion) {
case '1.0.0':
case '1.0.1':
break;
default:
return false;
}
return true;
}
Found in a Shopware Plugin
$(".alarmBell").on("click", () => {
let icon = $(".alarm-bell__icon")
icon.attr('data', icon.attr('data') == 'images/icon/alarm-bell.svg' ? 'images/icon/alarm-bell-filled-new.svg' : 'images/icon/alarm-bell.svg');
// $(".alarm-bell__icon").attr('data', function (index, data) {
// if (data == 'images/icon/alarm-bell-filled-new.svg') {
// return 'images/icon/alarm-bell.svg';
// } else if (data == 'images/icon/alarm-bell.svg') {
// return 'images/icon/alarm-bell-filled-new.svg';
// } else {
// return 'images/icon/alarm-bell.svg';
// }
// });
});
...after yet another icons change request
var doc = (Parent as Doc);
doc.Name = (doc != null) ? "" : doc.Name
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
for (InformacionPagareServiceDTO aux : res_pon.getListaRespuesta()) {
String pattern_dic = "{\"Estdo\":\"%s\", \"Fecha Firma\":\"%s\", \"Fecha Grabacion\": \"%s\", \"ID Pagare\": \"%s\",\"Nombre Otorgante\": \"%s\",\"Tipo documento Otorgante\": \"%s\",\"Documento Otorgante\": \"%s\",\"Numero Pagare Entidad\": \"%s\",\"Pdf Pagare Nom\": \"%s\",\"Pdf Pagare Cont\": \"%s\"}";
if (aux.getPdfPagare() == null) {
if(dic_txt.equals("")) {
dic_txt = String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare(), aux.getPdfPagare());
}else {
dic_txt += ","+String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare(), aux.getPdfPagare());
}
}else {
if(dic_txt.equals("")) {
dic_txt = String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare().getNombreArchivo(), aux.getPdfPagare().getContenido());
}else {
dic_txt += ","+String.format(pattern_dic, aux.getEstadoPagare(), aux.getFechaFirmaPagare(), aux.getFechaGrabacionPagare(), aux.getIdPagareDeceval(), aux.getNombreOtorgante(), aux.getTipoDocumentoOtorgante(), aux.getNumeroDocumentoOtorgante(), aux.getNumPagareEntidad(), aux.getPdfPagare().getNombreArchivo(), aux.getPdfPagare().getContenido());
}
}
}
Holy Shit
double func_atof(char *p){
double integer = 0.0, div = 1.0 , fract = 0.0 , sign = 1.0;
if( *p == 45 ){sign = -1.0, *p++ ; }
while ( isdigit(*p) ) {
integer = ( *p++ ) + (10.0 * integer) - 48.0 ;
}
if(*p == 46 ){
(*p++ ) ;
while ( isdigit(*p) ) {
fract = ( *p++ ) + (10.0 * fract) - 48.0 ;
div *= 10;
}
}
return (integer + fract / div ) * sign ;
}
if ($getCount) {
foreach ($all_items as $item) {
$item_arr[$item->id] = 0;
}
return count($item_arr);
}
// Check if marked for deletion and run finalizers
if k8sutil.IsMarkedForDeletion(instance.ObjectMeta) {
return r.checkFinalizers(ctx, log, instance)
}
final boolean True = true;
final boolean False = false;
//why
:v
if "[trait]" in lines[i]:
in_trait = True
elif "[/trait]" in lines[i]:
in_trait = False
elif "[object]" in lines[i]:
in_object = True
elif "[/object]" in lines[i]:
in_object = False
elif "[stage]" in lines[i]:
in_stage = True
elif "[/stage]" in lines[i]:
in_stage = False
elif "[cfg]" in lines[i]:
in_cfg = True
elif "[/cfg]" in lines[i]:
in_cfg = False
elif "[goal]" in lines[i]:
in_goal = True
elif "[/goal]" in lines[i]:
in_goal = False
#... 150 more lines of this
Basically, linting a config file with a DOM tree, using Python
bool vlNoExitIfZeroBytesReceived = false; // false: can exit when receive 0 later; 1: can not exit when receive 0 later;