- 1
Не сочтите за ханжество, но когда же прекратится этот содом?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Не сочтите за ханжество, но когда же прекратится этот содом?
забаньте пидора!
−2
В начале сентября Лицокнига представила т.н. "умные очки" - девайс в виде очков со встроенной камерой.
ФСБ России уже отнесли гаджет к УНПИ. Наказание за использование спецтехники - до 4 лет лишения свободы.
Не пойму, как можно назвать "шпионским устройством" предмет, который видит и слышит то же, что и его владелец.
+2
% Totoro sitting in the snow
% By Noa Hoffmann and Pascal Günthner, 21.12.2020
\documentclass[tikz,11pt]{{standalone}}
\usepackage{calligra}
\usepackage[T1]{fontenc}
\usetikzlibrary{%
shapes, shadows, patterns, calc,
decorations.shapes,
decorations.fractals,
decorations.markings,
decorations.pathmorphing
}
\colorlet{bodycolor}{black!35!gray!60!brown!98!green}
\colorlet{bellycolor}{yellow!70!white!92!green}
\tikzset{
furspot/.pic = {
\path [draw = black, thick, fill] (0,0)
.. controls +(0.3,0) and +(0.25,-0.05) .. ++(0.35,-.45)
.. controls +(-0.45,0.25) and +(0.1,0) .. ++(-0.85,-0.05)
.. controls +(-0.3,0.1) and +(-0.4, 0) .. cycle;
},
claw/.pic = {
\path [fill = bodycolor!70, draw] (0,0) arc (0:45:0.2 and 0.8)
arc (135:180:0.2 and 0.8)
arc (180:360:0.059) -- cycle;
},
whiskers/.pic = {
\path [fill = bodycolor!70,draw] (0,0) arc (0:45:0.05 and 2.3)
arc (135:180:0.3 and 2.3)
to[out=-90,in=-90] cycle;
},
snowflake/.pic = {
\fill [decoration = Koch snowflake, white] decorate{ decorate{
decorate{ (-0.5,-0.3) -- ++(60:1) -- ++(-60:1) -- cycle }}};
\foreach \i in {30, 90, 150, 210, 270, 330} {
\draw[blue!50!white,very thin] (0,0) -- +(\i:0.3);
}
\draw[decoration = Koch snowflake, blue!50!white, very thin]
decorate{($(0,0)+(60:0.2)$) -- ($(0,0)+(300:0.2)$) --
($(0,0)+(180:0.2)$) -- cycle};
}
}
\tikzset{
snow/.style = {decoration = {random steps, segment length = 2mm,
amplitude = 0.4mm}, decorate},
plush/.style = {decoration = {random steps, segment length = 1mm,
amplitude = 0.5mm},decorate}
}
\begin{document}
\begin{tikzpicture}[color = bodycolor, draw = black, thick]
%---------------------background and tail----------------------
% blue sky
\fill[blue!30!white] (-8cm,-11cm) rectangle (8cm,10cm);
% random snowflakes
\foreach \i in {0.1,0.11,...,1}{
\pic [scale = \i, opacity = 0.9] at (rand*7.5, rnd*18-10.5) {snowflake};}
% more tiny snowflakes
%\foreach \i in {0.1,0.11,...,0.5}{
%\pic [scale = \i, opacity = 0.9] at (rand*7.5, rnd*18-10.5) {snowflake};}
% cloud with merry christmas
\node [cloud,aspect = 6.5, cloud puff arc = 120, cloud puffs = 12.9, fill = white,
color = white] at (0,7) {\Huge M \hspace{9.8cm}.};
\node [color = red] at (0,7) {\fontsize{50}{80}
\textbf{Merry Christmas \quad }};
% tail
\path [draw, fill, rotate = 50] (-4,-7.5) circle (1.5 and 2.2);
% snowhill
\fill [draw, gray!6, snow] (-8,-11) to[in=200, out=0] (-3,-7.5) to (3,-7.5)
to[out=-20, in=180] (8,-11);
%--------------------body-----------------------------------------
% right ear
\path [fill, draw] (0.6,2.3)+(-45:1) arc (-60:35:1 and 1.5)
arc (115:210:1 and 1.5);
% left ear
\path [fill, draw] (-0.6,2.3)+(-135:1) arc (-120:-215:1 and 1.5)
arc (65:-30:1 and 1.5);
% head
\path [draw, fill] ($(0,0)+(170:2.5 and 2)$) arc (170:10:2.5 and 2)
arc(35:-20: 3 and 2)
-- ($(0,-0.8)+(200:3 and 2)$) arc (200:145:3 and 2) -- cycle;
% body
\path[fill] ($(0,-4)+(200:4 and 4.5)$) arc (200:-20:4 and 4.5);
%----------------------face----------------------------------------
% left eye
\path [draw, fill = white] (-1.4,0.7) circle (0.45 and 0.4);
\fill [black] (-1.2,0.7) circle (0.16);
\fill [white] (-1.24,0.74) circle (0.03);
% right eye
\path [draw, fill = white, thick] (1.4,0.7) circle (0.4);
\fill [black] (1.25,0.7) circle (0.16);
\fill [white] (1.20,0.74) circle (0.03);
% nose
\path [draw] (0.35, 0.7) .. controls (0.2,0.8) and (-0.2, 0.8)
.. (-0.35, 0.7);
Какое аниме ))) https://texample.net/tikz/examples/totoro/
0
#include <functional>
#include <string>
void rooster(uint32_t number)
{
}
void rooster(std::string& str)
{
}
int main()
{
//не осилил ни один компилятор
std::function<void(std::string&)> f = std::bind(&rooster, std::placeholders::_1);
//осилил gcc6.1+, но не может осилить clang 13.0
std::function<void(std::string&)> f2 = std::bind<void(std::string&)>(&rooster, std::placeholders::_1);
return 0;
}
Почему компиляторы крестов не могут сами разрулить ситуацию?
−1
<?php
function is_russian_char($c) {
return preg_match('/[А-Яа-яЁё]/u', $c);
}
function nemyxify_char($a) {
$map = [
"а" => "a",
"б" => "6",
"в" => "B",
"г" => "r",
"д" => "g",
"е" => "e",
"ё" => "e",
"ж" => "Jk",
"з" => "3",
"и" => "u",
"й" => "u",
"к" => "k",
"л" => "JI",
"м" => "M",
"н" => "H",
"о" => "o",
"п" => "n",
"р" => "p",
"с" => "c",
"т" => "m",
"у" => "y",
"ф" => "qp",
"х" => "x",
"ц" => "LL",
"ч" => "4",
"ш" => "LLI",
"щ" => "LLL",
"ь" => "b",
"ы" => "bI",
"ъ" => "b",
"э" => "3",
"ю" => "I0",
"я" => "9I",
"А" => "A",
"Д" => "D",
"Е" => "E",
"Ё" => "E",
"Ж" => "JK",
"И" => "U",
"Й" => "U",
"К" => "K",
"О" => "O",
"Р" => "P",
"С" => "C",
"Т" => "T",
"У" => "Y",
"Х" => "X",
];
if (isset($map[$a])) {
return $map[$a];
}
return $map[mb_strtolower($a)];
}
function gk_nemyxify($text) {
$res = '';
foreach (preg_split( '//u', $text, null, PREG_SPLIT_NO_EMPTY ) as $c) {
if (is_russian_char($c)) {
$res .= nemyxify_char($c);
} else {
$res .= $c;
}
}
return $res;
}
0
"Эффективный C. Профессиональное программирование" Роберт Сикорд.
Фуфел или новая "белая книга" ?
0
Internal error!
Save your work and restart IDE.
0
#include <iostream>
int main() {
std::cout << "Hello, shhhit!";
}
+1
#include <stdio.h>
#include <memory>
#define Property(type,name) type name;auto &set_##name(type val){name = val; return *this;}
#define Set(x,y) set_##x(y)
//#define Create(type, ...) (*(new type(__VA_ARGS__)))
template <typename T>
static inline T& Create_(const char *name)
{
return *(new T(name));
}
#define Create(type, ...) Create_<type>(__VA_ARGS__)
template <typename T>
static inline T CreateNoAlloc_(const char *name)
{
return T(name);
}
#define CreateNoAlloc(type, ...) CreateNoAlloc_<type>(__VA_ARGS__)
struct BaseItem
{
const char *Name;
BaseItem(const char *n): Name(n) {}
Property(int, Width);
Property(int, Height);
};
#include <vector>
struct Markup
{
std::vector<BaseItem*> Children;
template <typename T>
Markup &Add(T &item)
{
Children.push_back(&item);
return *this;
}
};
static inline Markup CreateMarkup(const char *n)
{
return Markup();
}
/*
struct Markup2
{
std::vector<std::shared_ptr<BaseItem>> Children;
template <typename T>
Markup2 &Add(T item)
{
Children.push_back(std::shared_ptr(&item));
return *this;
}
};
*/
template<std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I == sizeof...(Tp), void>::type
print(std::tuple<Tp...>& t)
{ }
template<std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I < sizeof...(Tp), void>::type
print(std::tuple<Tp...>& t)
{
printf("%s\n",std::get<I>(t).Name);
print<I + 1, Tp...>(t);
}
#include <string.h>
static BaseItem NOT_FOUND("NOT_FOUND");
template<typename T, std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I == sizeof...(Tp), void>::type
print1(std::tuple<Tp...>& t, const char *n)
{ }
template<typename T, std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I < sizeof...(Tp), T&>::type
print1(std::tuple<Tp...>& t, const char *n)
{
if( !strcmp(std::get<I>(t).Name, n))
return std::get<I>(t);
print1<T, I + 1, Tp...>(t,n);
return NOT_FOUND;
}
#define CreateMarkup(...) std::make_tuple(__VA_ARGS__)
#define AppendMarkup(src, ...) std::tuple_cat(src, std::make_tuple(__VA_ARGS__))
#define MarkupItem(markup,type,name,action) namespace {type &i = print1<type>(markup,name).action; }
auto markup1 = CreateMarkup(BaseItem("test").Set(Width,14), BaseItem("test2"));
auto markup2 = AppendMarkup(markup1,BaseItem("test3").Set(Width,15));
auto markup3 = markup1;
MarkupItem(markup3,BaseItem,"test2",Set(Width,16));
template <typename T>
Т.к юзается препроцессор, запощу в C
+1
function main() {
let c = 0;
try {
c++;
print("try");
throw "except";
c--;
print("after catch");
} finally {
c++;
print("finally");
}
assert(2 == c);
}
ну вот и все... проимплементил последний keyword в языке... (осталось только темплейты - ну и головняк меня ждем)