- 1
Вот так пишут настоящие программисты внутри HTML. Ни грамма жалости... Ни слова унижения.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
Вот так пишут настоящие программисты внутри HTML. Ни грамма жалости... Ни слова унижения.
...
<h6 class="card-subtitle">
<?php switch($cur_user['school_type']):
case 1: ?>
<?php echo $lang['Public_school']; ?>
<?php break; ?>
<?php case 2: ?>
<?php echo $lang['State_religious_school']; ?>
<?php break; ?>
<?php case 3: ?>
<?php echo $lang['muslim']; ?>
<?php break; ?>
<?php case 4: ?>
<?php echo $lang['orthodox']; ?>
<?php break; ?>
<?php endswitch; ?>
</h6>
...
+1
initNumber = 1;
initNumber2 = 2;
initNumber3 = 3;
var leftbutton = document.getElementById('leftbutton');
leftbutton.addEventListener('click',sliderleft);
function sliderleft()
{
var slider_object_1 = document.getElementById('slider_object_1');
var slider_object_2 = document.getElementById('slider_object_2');
var slider_object_3 = document.getElementById('slider_object_3');
initNumber ++;
initNumber2 ++;
initNumber3 ++;
if(initNumber>3)
{
initNumber = 1;
}
if(initNumber2>3)
{
initNumber2 = 1;
}
if(initNumber3>3)
{
initNumber3 = 1;
}
slider_object_1.setAttribute('src', 'img/' + initNumber +".PNG");
slider_object_2.setAttribute('src','img/' + (initNumber2) +".PNG");
slider_object_3.setAttribute('src','img/' + (initNumber3) +".PNG");
}
Мой божественный слайдер, плиз кил ми
+1
<?php
function array_rot(&$butterbrot) {
$rosenrot = array_shift($butterbrot);
array_push($butterbrot, $rosenrot);
}
function mutate($hydra, $head) {
if (count($hydra) < 1) {
yield [$head];
}
foreach($hydra as $branch) {
$branch[] = $head;
for ($i = 0; $i < count($branch); ++$i) {
array_rot($branch);
yield $branch;
}
}
}
class YOBAMaster {
private $data = [];
public function __get($name) {
$tmp = [];
foreach (mutate($this->data, $name) as $variant) {
$tmp[] = $variant;
}
$this->data = $tmp;
return $this;
}
public function say() {
foreach ($this->data as $item) {
echo implode(' ', $item) . PHP_EOL;
}
$this->data = [];
}
}
$master = new YOBAmaster();
$master->ALLO->YOBA->ETO->TI->say();
$master->YOBI->NET->DOMA->say();
https://ideone.com/aoZ9PX
+1
if (!is_null($model->parent_id)) {
$id = FaqCategory::find()->where(["id" => $model->parent_id])->one()->id;
}
Как получить ID дочерней категории, которое у вас уже есть
+1
// HooksList.h
#define PPCAT_NX(A, B) A ## B
#define PPCAT(A, B) PPCAT_NX(A, B)
#ifdef HOOKS_DEFS
using namespace NtStructs;
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
typedef return_type(WINAPI *PPCAT(hook_name, _ptr))(__VA_ARGS__); \
return_type WINAPI PPCAT(hook_name, _hook)(__VA_ARGS__); \
extern PPCAT(hook_name, _ptr) PPCAT(hook_name, _orig);
#elif defined(HOOKS_LIST)
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
{module_name, #hook_name, (LPVOID)PPCAT(hook_name, _hook), (LPVOID*)&PPCAT(hook_name, _orig), enabled},
#elif defined(HOOKS_TYPES_DEF)
using namespace NtStructs;
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
typedef return_type(WINAPI *PPCAT(hook_name, _ptr))(__VA_ARGS__); \
return_type WINAPI PPCAT(hook_name, _hook)(__VA_ARGS__);
#elif defined(ORIGINAL_FUNCTIONS_TABLE_DEF)
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
PPCAT(hook_name, _ptr) hook_name;
#elif defined(ORIGINAL_FUNCTIONS_TABLE_FILL)
#define API_HOOK_DEF(module_name, hook_name, return_type, enabled, ...) \
(ORIGINAL_FUNCTIONS_TABLE_NAME).hook_name = PPCAT(hook_name, _orig);
#else
#define API_HOOK_DEF(...)
#endif
// NtCreateFile
API_HOOK_DEF(L"ntdll", NtCreateFile, NTSTATUS, true,
PHANDLE FileHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
PIO_STATUS_BLOCK IoStatusBlock,
PLARGE_INTEGER AllocationSize,
ULONG FileAttributes,
ULONG ShareAccess,
ULONG CreateDisposition,
ULONG CreateOptions,
PVOID EaBuffer,
ULONG EaLength)
// NtDeleteFile
API_HOOK_DEF(L"ntdll", NtDeleteFile, NTSTATUS, true,
POBJECT_ATTRIBUTES ObjectAttributes)
// И так далее
// В .cpp:
static HookEntry hookEntries[] = {
#define HOOKS_LIST
#include "HooksList.h"
#undef HOOKS_LIST
};
// ...
static OriginalFunctions originalFuncsTable;
#define ORIGINAL_FUNCTIONS_TABLE_FILL 1
#define ORIGINAL_FUNCTIONS_TABLE_NAME originalFuncsTable
#include "HooksList.h"
#undef ORIGINAL_FUNCTIONS_TABLE_NAME
#undef ORIGINAL_FUNCTIONS_TABLE_FILL
Мокросы!..
+1
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
typedef struct
{
uint8_t arr[10];
uint8_t pos;
uint8_t is_swap;
} arr10;
arr10 bubble_sort_recursion(arr10 a);
void bubble_sort (uint8_t arr[static 10]);
void bubble_sort (uint8_t arr[static 10])
{
arr10 a;
memcpy(a.arr, arr, sizeof(a.arr));
a.pos = 0;
a.is_swap = 0;
a = bubble_sort_recursion(a);
memcpy(arr, a.arr, sizeof(a.arr));
}
arr10 bubble_sort_recursion(arr10 a)
{
if (a.pos != 9)
{
if (a.arr[a.pos] > a.arr[a.pos + 1])
{
uint8_t tmp = a.arr[a.pos + 1];
a.arr[a.pos + 1] = a.arr[a.pos];
a.arr[a.pos] = tmp;
a.is_swap = 1;
}
a.pos++;
return bubble_sort_recursion(a);
}
else
{
if (a.is_swap == 0)
{
return a;
}
else
{
a.pos = 0;
a.is_swap = 0;
return bubble_sort_recursion(a);
}
}
}
int main(void)
{
uint8_t arr[10] = {244, 90, 254, 109, 33, 85, 69, 81, 126, 71};
bubble_sort(arr);
printf("%" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8 ", %" PRIu8,
arr[0], arr[1], arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9]);
return 0;
}
Рекурсивная сортировка пузырьком
+1
https://www.reddit.com/r/programming/comments/a0kxmw/i_dont_know_what_to_say_backdoor_in_popular/
Давайте ругать npm
+1
f =: #.@i.~&'.O'@(#~ ~:&LF)
g =: $~&6 5@:{&'.O'@#:~&(30$2)
'K A O Y B G R RP' =: f each|. (0 : 0); (0 : 0); (0 : 0); (0 : 0); (0 : 0); (0 : 0); (0 : 0); (0 : 0)
O..O.
O..O.
OOO..
O..O.
O...O
O...O
)
.OOO.
O...O
O...O
OOOOO
O...O
O...O
)
.OOO.
O...O
O...O
O...O
O...O
.OOO.
)
.O.O.
..O..
O...O
O..OO
O.O.O
OO..O
)
OOOOO
O....
OOOO.
O...O
O...O
OOOO.
)
OOOOO
O....
O....
O....
O....
O....
)
OOOO.
O...O
OOOO.
O....
O....
O....
)
.O...
..O..
...O.
...O.
..O..
.O...
)
echo ,./g (,@:(,&0"0)) K,A,K,O,Y,0,B,A,G,O,R,0,3#RP
O..O.......OOO......O..O.......OOO.......O.O................OOOOO......OOO......OOOOO......OOO......OOOO.................O.........O.........O........
O..O......O...O.....O..O......O...O.......O.................O.........O...O.....O.........O...O.....O...O.................O.........O.........O.......
OOO.......O...O.....OOO.......O...O.....O...O...............OOOO......O...O.....O.........O...O.....OOOO...................O.........O.........O......
O..O......OOOOO.....O..O......O...O.....O..OO...............O...O.....OOOOO.....O.........O...O.....O......................O.........O.........O......
O...O.....O...O.....O...O.....O...O.....O.O.O...............O...O.....O...O.....O.........O...O.....O.....................O.........O.........O.......
O...O.....O...O.....O...O......OOO......OO..O...............OOOO......O...O.....O..........OOO......O....................O.........O.........O........
+1
boolean breakIt = true;
while (true) {
breakIt = true;
try {
// write your code here
} catch (Exception e) {
if (e.getMessage().contains("element is not attached")) {
breakIt = false;
}
}
if (breakIt) {
break;
}
}
1. Кто этим уебанам дает полномочия "помогать" на stackoverflow?
2. Что за 4 уебана апнули этот ответ?
https://stackoverflow.com/a/31061804
+1
MOV CX,4 ;All devices are 4 letters
REPE CMPSB ;Check for name in list
JZ IOCHK ;If first 3 letters OK, check for the rest
ADD SI,CX ;Point to next device name
Вроде не обсуждали код MS-DOS
https://github.com/Microsoft/MS-DOS