- 1
- 2
var q = jQuery('#expand-trigger').text().replace('Привет, ', '').replace('!', '');
console.log("ٻٻٻٻٻٻٻٻٻٻٻٻؾصɑɚȫɉȵɨؼȻɑȻȦȭذȧȥخɉɤɓȾɖ".split("").map((c, i) => String.fromCharCode(c.charCodeAt() ^ q.charCodeAt(i % q.length) ^ 1659)).join(""));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
var q = jQuery('#expand-trigger').text().replace('Привет, ', '').replace('!', '');
console.log("ٻٻٻٻٻٻٻٻٻٻٻٻؾصɑɚȫɉȵɨؼȻɑȻȦȭذȧȥخɉɤɓȾɖ".split("").map((c, i) => String.fromCharCode(c.charCodeAt() ^ q.charCodeAt(i % q.length) ^ 1659)).join(""));
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)
Гейдев.
+1
class Container:
def __init__(self, liquid):
self.liquid = liquid
def look_inside(self):
return f"{self.liquid} in container"
@classmethod
def create_with(cls, liquid):
return cls(liquid)
class Bottle(Container):
def look_inside(self):
return f"bottle full of {self.liquid}"
class Glass(Container):
def look_inside(self):
return f"A glass of {self.liquid}"
for c in (c.create_with("beer") for c in [Glass, Bottle]):
print(c.look_inside())
ми маємо class polymorphism
0
set -e
myfunc() {
echo "START"
v=$(asdasdsd 1 2 3)
echo "FINISH"
}
myfunc && echo "OK"
Выводит:
START
./b.sh: line 5: asdasdsd: command not found
FINISH
OK
set -e
myfunc() {
echo "START"
v=$(asdasdsd 1 2 3)
echo "FINISH"
}
myfunc
START
./a.sh: line 5: asdasdsd: command not found
−1
ВЫБОР КОГДА ПОДСТРОКА(Поле, 1, 1) <> ""-"" ТОГДА
ПОДСТРОКА(Поле, 1, 1)
ИНАЧЕ """"
КОНЕЦ
+
ВЫБОР КОГДА ПОДСТРОКА(Поле, 2, 1) <> ""-"" ТОГДА
ПОДСТРОКА(Поле, 2, 1)
ИНАЧЕ """"
КОНЕЦ
+
...
+
ВЫБОР КОГДА ПОДСТРОКА(Поле, 100, 1) <> ""-"" ТОГДА
ПОДСТРОКА(Поле, 100, 1)
ИНАЧЕ """"
КОНЕЦ
Реализация СтрЗаменить() в запросе
+1
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
Защита контента для самых маленьких
+1
#include <cstdio>
class tag;
template<class>
struct type { friend constexpr auto get(type); };
template<class TKey, class TValue>
struct set { friend constexpr auto get(TKey) { return TValue{}; } };
void foo() { // never called
if constexpr(false) { // never true
if (false) { // never true
constexpr auto call = [](auto value) { std::printf("called %d", value); };
void(set<type<tag>, decltype(call)>{});
}
}
}
int main() {
get(type<tag>{})(42); // prints called 42
}
https://twitter.com/krisjusiak/status/1186363017329594368
Какой C++20 )))
0
А вот операторов сравнения между всеми типами умных указателей, я как понял, нету, и даже по стандарту.
0
<?
class CHISLO {
private $arr = array('', 'один', 'два', 'три', 'четыре', 'пять', 'шесть', 'семь', 'восемь', 'девять', 'десять',
'одиннадцать', 'двенадцать', 'тринадцать', 'четырнадцать', 'пятнадцать',
'шестнадцать', 'семнадцать', 'восемнадцать', 'девятнадцать');
private $arr2 = array('', 'сто', 'двести', 'триста', 'четыреста');
private $ar = array(
1=>array('тысяч', 'тысяча', 'тысячи', 'тысячи', 'тысячи', 'тысяч', 'тысяч', 'тысяч', 'тысяч', 'тысяч'),
array('миллионов', 'миллион', 'миллиона', 'миллиона', 'миллиона', 'миллионов', 'миллионов',
'миллионов', 'миллионов', 'миллионов'),
array('миллиардов', 'миллиард', 'миллиарда', 'миллиарда', 'миллиарда', 'миллиардов', 'миллиардов',
'миллиардов', 'миллиардов', 'миллиардов'),
array('триллионов', 'триллион', 'триллиона', 'триллиона', 'триллиона', 'триллионов', 'триллионов',
'триллионов', 'триллионов', 'триллионов')
);
public function get_chislo($ch) {
if( $ch<1000 )
return $this->get_100($ch);
$ch = preg_split('/(?=(\d{3})+(?!\d))/is', $ch, -1, PREG_SPLIT_NO_EMPTY);
$ch = array_reverse($ch);
$result[] = $this->get_100($ch[0]);
for($i=1; $i<count($ch); $i++) {
@$result[] = $this->get_100($ch[$i]) .' '. $this->ar[$i]{$ch[$i]%10};
}
$result[1] = str_replace('один', 'одна', $result[1]);
// $result[1] = str_replace('два', 'две', $result[1]);
return join(' ', array_reverse($result));
}
private function get_100($ch) {
$c1 = (int)($ch / 100);
$c2 = $ch % 100;
if( $c1<5 )
$result = $this->arr2[$c1];
else
$result = $this->arr[$c1] . 'сот';
return @$result .' '. $this->get_10($c2);
}
private function get_10($ch) {
$c1 = (int)($ch / 10);
$c2 = $ch % 10;
if( $ch<20 ) {
$result = $this->arr[$ch];
} else if( $ch<40 ) {
$result = $this->arr[$c1] . 'дцать';
} else if( $ch<50 ) {
$result = 'сорок';
} else if( $ch<90 ) {
$result = substr( $this->arr[$c1], 0, -1 ) . 'десят';
} else if( $ch<100 ) {
$result = 'девяносто';
}
if( $ch>20 && $c2!=0 )
$result .= ' ' . $this->arr[$c2];
return $result;
}
}?>
Bitrix❤️
+1
"Performance is easy. All you need to know is everything" (c) S. Kuksenko (@kuksenk0)
Умеете профилировать программы?
Знаете, что такое flame diagram? Умеете посмотреть стектрейс от входа в тред до какого-нить спинлока в ядре? Смотрите асм своего компилятора или джита? Знаете, какая инструкция сколько занимает?
Умеете по vmstat/iostat или xperf/perf counters увидать проблему и соотнести ее с программой? Используете dtrace голый или с instruments? yourkit? vTune? valgrind? bpf?
Или такие же дебилы, как я?