- 1
- 2
- 3
- 4
- 5
- 6
scheduler.queue.async { [weak self] in
guard let weakself = self else {
return
}
let locations = weakself.interactor
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
scheduler.queue.async { [weak self] in
guard let weakself = self else {
return
}
let locations = weakself.interactor
0
import java.util.Scanner;
public class MasInd {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Введите массу тела в килограммах");
double m = sc.nextDouble();
System.out.println("Введите рост в метрах");
double r = sc.nextDouble();
double i = m/(r*r);
System.out.println("Индекс массы тела = " + i);
if (i>=18.5 & i<25) {
System.out.println("Норма");
}
if (i>=25 & i<30) {
System.out.println("Предожирение");
}
if (i>=30) {
System.out.println("Ожирение");
}
if (i<18.5) {
System.out.println("Дефицит массы тела");
}
}
}
Определитель индекса массы тела.
У меня, кстати, индекс - 22.47 (норма).
−267
import execjs
js = '{"1": "2", "3": [4,5]}'
default = execjs.get()
print default.eval(js)
Раз уже астрологи объявили неделю ебанутого парсенья json.
+89
(1 until n) flatMap (i => (1 until i) filter (j => isPrime(i+j)) map (j => (i, j)))
Скала говна.
+3
for (size_t i = 0; i < 4; ++i) {
__m128 x0 = _mm_loadu_ps((const float*)blocks[0] + i * 4);
__m128 x1 = _mm_loadu_ps((const float*)blocks[1] + i * 4);
__m128 x2 = _mm_loadu_ps((const float*)blocks[2] + i * 4);
__m128 x3 = _mm_loadu_ps((const float*)blocks[3] + i * 4);
__m128 t0 = _mm_unpacklo_ps(x0, x1);
__m128 t1 = _mm_unpackhi_ps(x0, x1);
__m128 t2 = _mm_unpacklo_ps(x2, x3);
__m128 t3 = _mm_unpackhi_ps(x2, x3);
x[i * 4 + 0] = _mm_castps_si128(_mm_movelh_ps(t0, t2));
x[i * 4 + 1] = _mm_castps_si128(_mm_movehl_ps(t2, t0));
x[i * 4 + 2] = _mm_castps_si128(_mm_movelh_ps(t1, t3));
x[i * 4 + 3] = _mm_castps_si128(_mm_movehl_ps(t3, t1));
}
4х MD5
https://ideone.com/a8YcZ8
0
local money = 0
local auto_money = 0
local auto_money_lvl = 0
local auto_money_buy = 50
local bonus_money_lvl = 0
local bonus_money_buy = 35
local json_pip = require("json")
local bacg = display.newRect(0,0,1080,1920)
local button = display.newRect(160,190,175,175)
button:setFillColor(0,0.4,0.3)
local button_auto = display.newRect(70,400,111,111)
button_auto:setFillColor(0,0.4,0.3)
local button_bonus = display.newRect(250,400,111,111)
button_bonus:setFillColor(0,0.4,0.3)
local text = display.newText("Click", 161, 190, "consolas", 30)
text:setFillColor(1,1,1)
local text1 = display.newText("Money:", 64, -19, "consolas", 30)
text1:setFillColor(0,0.1,0.8)
local text2 = display.newText(money, 200, -16, "consolas", 30)
text2:setFillColor(0,0.1,0.8)
local text3 = display.newText("Auto", 70, 370, "consolas", 30)
text3:setFillColor(1,1,1)
local text4 = display.newText("click", 70, 400, "consolas", 30)
text4:setFillColor(1,1,1)
local text5 = display.newText(auto_money_buy, 70, 437, "consolas", 30)
text5:setFillColor(1,1,1)
local text6 = display.newText("Bonus", 250, 370, "consolas", 30)
text6:setFillColor(1,1,1)
local text7 = display.newText("click", 250, 400, "consolas", 30)
text7:setFillColor(1,1,1)
local text8 = display.newText(bonus_money_buy, 250, 437, "consolas", 30)
text8:setFillColor(1,1,1)
ocal button_shadow = display.newRect(160,280,175,10)
button_shadow:setFillColor(0,0.3,0.4)
local button_shadow_auto = display.newRect(70,460,111,10)
button_shadow_auto:setFillColor(0,0.3,0.4)
local button_shadow_bonus = display.newRect(250,460,111,10)
button_shadow_bonus:setFillColor(0,0.3,0.4)
local copyright = display.newText("KernelCoreSW 2018-2019", 163, 490, "consolas", 23)
copyright:setFillColor(0,0.1,0.8)
local function flapBird (event)
if(event.phase == "began") then
---lvl
if(bonus_money_lvl == 0) then
money = money + 1
end
if(bonus_money_lvl == 1) then
money = money + 2
end
--И еще такого говнаролла штук 10
text2.text = money
end
local function flapBird_bonus (event)
if(event.phase == "began") then
if(money >= bonus_money_buy) then
money = money - bonus_money_buy
bonus_money_buy = bonus_money_buy * 3
bonus_money_lvl = bonus_money_lvl + 1
end
text2.text = money
text8.text = bonus_money_buy
end
end
local function onUpdate (args)
if(auto_money > 40) then
auto_money = 0
end
---------levels
if(auto_money_lvl == 1) then
if(auto_money == 40) then
money = money + 1
text2.text = money
end
end
---------levels end и еще такого говна штук 10
auto_money = auto_money + 1
end
local function load_settings(fileName)
local path = system.pathForFile(fileName, system.ResourceDirectory)
local contents = ""
local myTable = {}
local file = io.open(path, "r")
if(file) then
contents = file:read("*a")
myTable = json.decode(contents)
io.close(file)
return myTable
end
return nil
end
local settings = loadSettings("settings.json")
if(settings) then
money = settings.money
auto_money = settings.auto_money
auto_money_buy = settings.auto_money_buy
auto_money_lvl = settings.auto_money_lvl
bonus_money_lvl = settings.bonus_money_lvl
bonus_money_buy = settings.bonus_money_buy
end
button:addEventListener("touch", flapBird)
button_auto:addEventListener("touch", flapBird_auto)
button_bonus:addEventListener("touch", flapBird_bonus)
Runtime:addEventListener("enterFrame", onUpdate)
Гейдев.
+106
< !DOCTYPE html >
< html >
< head >
< title >Температура процессора< /title >
< meta http-equiv="content-type" content="text/html; charset=windows-1251" / >
< asm >
mov dx, 295h
mov al, 4Eh
out dx, al
inc dx
in al, dx
or al, 1
out dx, al
dec dx
mov al, 50h
out dx, al
in al, dx
mov #temperature, al
< /asm >
< /head >
< body >
< span id="temperature" >< /span >
< /body >
< /html >
https://otvet.mail.ru/question/185609056
0
struct X {
int x;
int y;
X(int y_) :
y(y_),
x(y + 10)
{
}
};
int main()
{
X foo = X(16);
std::cout << "foo == (" << foo.x << ", " << foo.y << ")" << std::endl;
}
+1
SET @from = 11836;
SET @to = 11840;
INSERT INTO `sprinter_catalog_tree` (
`sprinter_catalog_tree`.`level`,
`sprinter_catalog_tree`.`position`,
`sprinter_catalog_tree`.`parent_id`,
`sprinter_catalog_tree`.`catalog`,
`sprinter_catalog_tree`.`info_id`,
-- ...
)
SELECT
`sprinter_catalog_tree`.`level`,
`sprinter_catalog_tree`.`position`,
@to,
`sprinter_catalog_tree`.`catalog`,
`sprinter_catalog_tree`.`info_id`,
`sprinter_catalog_tree`.`format_id`,
`sprinter_catalog_tree`.`linked_id`,
`sprinter_catalog_tree`.`linked_shablon_id`,
-- ...
FROM `sprinter_catalog_tree` where parent_id = @from order by id;
INSERT INTO `sprinter_catalog_tree` (
`sprinter_catalog_tree`.`level`,
`sprinter_catalog_tree`.`position`,
`sprinter_catalog_tree`.`parent_id`,
`sprinter_catalog_tree`.`catalog`,
`sprinter_catalog_tree`.`info_id`,
-- ...
)
SELECT
a.`level`,
a.`position`,
(SELECT id from sprinter_catalog_tree as b where b.parent_id = @to and b.name like (SELECT name from sprinter_catalog_tree where id = a.parent_id)),
a.`catalog`,
a.`info_id`,
a.`format_id`,
a.`linked_id`,
a.`linked_shablon_id`,
-- ...
FROM `sprinter_catalog_tree` as a where parent_id in (SELECT id FROM sprinter_catalog_tree where parent_id = @from) order by id;
INSERT INTO `sprinter_catalog_info`
(`name`,
`eng_name`,
`text`,
-- ..
)
SELECT
`sprinter_catalog_info`.`name`,
`sprinter_catalog_info`.`eng_name`,
`sprinter_catalog_info`.`text`,
`sprinter_catalog_info`.`short_text`,
-- ...
FROM `sprinter_catalog_info` where id in (SELECT info_id from `sprinter_catalog_tree` where parent_id = @from or parent_id in (SELECT id from `sprinter_catalog_tree` where parent_id = @from));
CREATE temporary table if not exists ids
SELECT id from `sprinter_catalog_tree` where parent_id = @to or parent_id in (SELECT id from `sprinter_catalog_tree` where parent_id = @to);
UPDATE sprinter_catalog_tree as a SET info_id = (SELECT id from sprinter_catalog_info as b where a.name like b.name order by id desc limit 1) where a.id in (SELECT id from ids);
DROP table ids;
Высрал вот такое говно в качестве write-n-throw скрипта.
Дано: есть элементы дерева, хранящиеся в таблице sprinter_catalog_tree, связаны друг с другом через parent_id. Каждому из них соответствует указанный в info_id элемент таблицы sprinter_catalog_info.
Задача: скопировать все вложенные в раздел @from каталога элементы и его подразделы (вложенность не более 1 уровня) в раздел @to, так чтобы у них были новые id, и также скопировать соответствующие им sprinter_catalog_info. Скопированные sprinter_catalog_tree должны указывать на корректные sprinter_catalog_info, id которых заранее не известны.
Вот такое говно получилось, расскажите как надо было?
+125
#include "server.h"
const server::CServer s(8085, 1111);
int main() {return 0;}
http://habrahabr.ru/post/213301/
От автора http://govnokod.ru/14526
>И еще на мой взгляд, функция main() — атавизм, доставшийся программистам от СИ. В С++ она лишняя. Но компиляторы пока этого не знают к сожалению.
>Но я решил «наказать» эту ненужную функцию, отобрав у нее возможность что-либо сделать — изменил файл serv.cpp следующим образом