- 1
- 2
- 3
<?php
echo implode ("<br>", file("govnokod.php"));
?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
<?php
echo implode ("<br>", file("govnokod.php"));
?>
Угадайте как называется это!
+1
Где можно посмотреть исходники "PHP" как можно раньшей релизной версии?
+1
for(int b = 0; b < len; b++){
resultByte[b] = (byte)(buf[b] & 0xFF);
crc32 ^= (buf[b] << 24);
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
if(crc32 < 0) {crc32 = (crc32 << 1) ^ POLYNOMIAL;} else {crc32 = crc32 << 1;}
}
resultByte[len+3] = (byte)(crc32 & 0xFF);
resultByte[len+2] = (byte)((crc32 >>> 8) & 0xFF);
resultByte[len+1] = (byte)((crc32 >>> 16) & 0xFF);
resultByte[len] = (byte)((crc32 >>> 24) & 0xFF);
+1
/* Get LDAC handle */
LDACBT_API HANDLE_LDAC_BT ldacBT_get_handle( void )
/* Free LDAC handle */
LDACBT_API void ldacBT_free_handle( HANDLE_LDAC_BT hLdacBT )
/* Close LDAC handle */
LDACBT_API void ldacBT_close_handle( HANDLE_LDAC_BT hLdacBT )
/* Get ERROR CODE */
LDACBT_API int ldacBT_get_error_code( HANDLE_LDAC_BT hLdacBT )
/* Get Configured Sampling frequency */
LDACBT_API int ldacBT_get_sampling_freq( HANDLE_LDAC_BT hLdacBT )
СОНЭ умеет в комментарии.
https://android.googlesource.com/platform/external/libldac/+/master/src/ldacBT_api.c
+1
https://pbs.twimg.com/media/Dl4x_P-XsAAPfgC.jpg
https://twitter.com/_inside/status/1035319938641276928 The Apple Watch pride face is hardcoded to not show up if the paired iPhone is using the Russian locale
> Однако 30 октября 2014 года в статье на Bloomberg Businessweek Кук совершил каминг-аут, признавшись в своей гомосексуальности, и выразил надежду, что это признание поможет другим геям принять себя и вдохновит их на борьбу за свои права.
Бабло победило принципы
+1
-
#
## #### #### ##### ######
# # # # # # # #
# # #### # # #####
# ### # # ##### #
# ### # # # # # # #
##### ### #### #### # # #
# # ###### ##### # ###### # #### ## ##### # #### # #
# # # # # # # # # # # # # # # # ## #
# # ##### # # # ##### # # # # # # # # # # #
# # # ##### # # # # ###### # # # # # # #
# # # # # # # # # # # # # # # # # ##
## ###### # # # # # #### # # # # #### # #
###### ##### ##### #### #####
# # # # # # # # #
##### # # # # # # # #
# ##### ##### # # #####
# # # # # # # # #
###### # # # # #### # #
+1
class TaxStorage {
public:
using TaxCode = Code<3>; // Code<int N, typename Storage = uint32_t> тип для маленьких строк
using TaxType = Code<3>;
using TaxId = std::tuple<TaxCode, TaxType>;
using TaxMap = std::map<TaxId, int>
using CityId = int;
using TaxPointMap = std::unordered_map<CityId, TaxMap>;
TaxMap forCityOrOther(const TaxPointMap& map, const CityId cityId) const {
const auto found = map.find(cityId);
return found == map.cend() ? map.at(OTHER_CITY) : *found; // должно быть found->second
}
}
Dev: Ok GCC, tell me what is wrong.
GCC: /home/whatever/project/TaxStorage.h:102: error: incompatible operand types ('const std::unordered_map<int, std::map<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> >, std::less<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> > >, std::allocator<std::pair<const std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> > > > >, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<const int, std::map<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> >, std::less<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> > >, std::allocator<std::pair<const std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> > > > > > > >::mapped_type' (aka 'const std::map<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> >, std::less<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> > >, std::allocator<std::pair<const std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> > > > >') and 'const std::pair<const int, std::map<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> >, std::less<std::tuple<Code<3, unsigned int>, Code<3, unsigned int> > >, std::allocator<std::pair<const std::tuple<Code<3, unsigned int>, Code<3, unsigned int> >, std::vector<unsigned long, std::allocator<unsigned long> > > > > >')
ДОКОЛЕ?!!
+1
#include <iostream>
#include <type_traits>
#include <utility>
#include <array>
template<size_t Size, typename T, typename FunctorType, size_t... idx>
constexpr std::array<decltype(std::declval<FunctorType>().operator()(std::declval<T>())), Size>
map_impl(const std::array<T, Size> & arr, FunctorType && f, std::index_sequence<idx...>)
{
return std::array{ f(std::get<idx>(arr))... };
}
template<size_t Size, typename T, typename FunctorType>
constexpr std::array<decltype(std::declval<FunctorType>().operator()(std::declval<T>())), Size>
map(const std::array<T, Size> & arr, FunctorType && f)
{
return map_impl(arr, f, std::make_index_sequence<Size>{});
}
struct MyFunctor {
constexpr float operator()(int arg)
{
return static_cast<float>(arg * arg) / 2.0f;
}
};
int main()
{
constexpr std::array arr{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
auto arrMappedFunctor = map(arr, MyFunctor{});
auto arrMappedLambda = map(arr, [](int x) constexpr { return static_cast<float>(x * x) / 2.0f; });
for (auto && x : arrMappedFunctor) {
std::cout << x << ' ';
}
std::cout << std::endl;
for (auto && x : arrMappedLambda ) {
std::cout << x << ' ';
}
std::cout << std::endl;
return 0;
}
0.5 2 4.5 8 12.5 18 24.5 32 40.5 50
0.5 2 4.5 8 12.5 18 24.5 32 40.5 50
Метушня выходит на новый уровень: полноценный map в compile-time. Поддерживает как ручные функторы с перегруженным operator(), так и constexpr-лямбды. При помощи небольшой модификации возможно реализовать поддержку кортежей с произвольными типами.
+1
Давайте течь от отступов и ругать код без оных.
+1
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#define next ;
#define zero 0
#define one 1
#define two 2
#define three 3
#define four 4
#define five 5
#define six 6
#define seven 7
#define eight 8
#define nine 9
#define dot .
#define begin {
#define end }
#define open (
#define close )
#define sqopen [
#define sqclose ]
#define less <=
#define xless <
#define greater >=
#define xgreater >
#define isnt !=
#define isequal ==
#define mustbe =
#define write cout
#define plus +
#define minus -
#define multi *
#define divby /
#define incr +=
#define decr -=
using namespace std next
string pswdGen open int quantity close begin
srand open time open 0 close close next
char chars sqopen sqclose mustbe "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890@\#\$\%\&\-\+\!\/\_" next
string password next
for(int i = zero next i xless quantity next i++) begin
password incr chars sqopen rand open close % open sizeof open chars close divby sizeof open *chars close close sqclose next
end
return password next
end
int main open close begin
int charNo next
write << "How many characters do you want in the password?" << endl next
cin >> charNo next
write << "Your new password is: " << pswdGen open charNo close << endl next
return zero next
end
По сути это тот же крестовый паролегенератор, но из-за дефайнов и от того символов можно отнести в кучу. И да, "Переведи на "зрз"" в сторону. Перевел вам за щеку, проверяйте