- 1
- 2
- 3
- 4
- 5
List<UserScoreDTO> userScores = users.stream()
.map((u) -> ScoreUtils.aggregateUserAndFlagData(u, maxTestScore))
.collect(toList());
return userScores.stream();
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
List<UserScoreDTO> userScores = users.stream()
.map((u) -> ScoreUtils.aggregateUserAndFlagData(u, maxTestScore))
.collect(toList());
return userScores.stream();
Collect to List<UserScoreDTO> then stream the list to Stream<UserScoreDTO>
0
# while 1 через for
shits = ['говно']
for shit in shits:
print('Говно')
shits.append('говно')
Прост while 1 через for
+1
吾有一術。名之曰「斐波那契」。欲行是術。必先得一數。曰「甲」。乃行是術曰。
若「甲」等於零者乃得零也
若「甲」等於一者乃得一也
減「甲」以一。減「甲」以二。名之曰「乙」。曰「丙」。
施「斐波那契」於「乙」。名之曰「丁」。
施「斐波那契」於「丙」。名之曰「戊」。
加「丁」以「戊」。名之曰「己」。
乃得「己」。
是謂「斐波那契」之術也。
施「斐波那契」於十二。書之。
文言 wenyan-lang
Числа Фибоначчи.
https://github.com/wenyan-lang/wenyan
+3
class Person {
protected name: string;
constructor(name: string) { this.name = name; }
}
class Employee extends Person {
private department: string;
constructor(name: string, department: string) {
super(name);
this.department = department;
}
public get ElevatorPitch() {
return `Hello, my name is ${this.name} and I work in ${this.department}.`;
}
}
const howard = new Employee("Howard", "Sales");
console.log(howard.ElevatorPitch);
//===============================================>>>>>>>>>>>>>>>>>>
#ifndef TEST_H
#define TEST_H
#include "core.h"
using namespace js;
class Person;
class Employee;
class Person : public object, public std::enable_shared_from_this<Person> {
public:
string name;
Person(string name);
};
class Employee : public Person, public std::enable_shared_from_this<Employee> {
public:
string department;
Employee(string name, string department);
virtual any get_ElevatorPitch();
Employee(string name);
};
extern std::shared_ptr<Employee> howard;
#endif
#include "test.h"
using namespace js;
Person::Person(string name) {
this->name = name;
}
Employee::Employee(string name, string department) : Person(name) {
this->department = department;
}
any Employee::get_ElevatorPitch()
{
return "Hello, my name is "_S + this->name + " and I work in "_S + this->department + "."_S;
}
Employee::Employee(string name) : Person(name) {
}
std::shared_ptr<Employee> howard = std::make_shared<Employee>("Howard"_S, "Sales"_S);
void Main(void)
{
console->log(howard->get_ElevatorPitch());
}
int main(int argc, char** argv)
{
Main();
return 0;
}
Было делать нехрен в жизни и решил наговнокодить транспайлер с TypeScript в С++
https://github.com/ASDAlexander77/TypeScript2Cxx
+1
<?php
function qes2_key ( $key = null ) {
$key = str_split( $key );
$keycount = count( $key );
$xspos = 1;
$summ = 0;
foreach( $key as $letter ) {
$summ += ord( $letter ) * 2 + $xspos + ( $keycount / $xspos );
$xspos++;
}
$summ = explode('.', $summ );
return $summ[0];
}
function qes2_encrypt ( $input, $key ) {
$input = str_split( $input );
$icount = count( $input );
$rsumm = qes2_key( $key );
$result = '';
$xspos = 1;
$xsdisp = 1;
foreach( $input as $letter ) {
$char = ord( $letter ) + ( $rsumm * $xspos ) - $xsdisp ;
$result .= chr( $char );
$xspos++;
$xsdisp += 1;
}
return $result;
}
function qes2_decrypt ( $input, $key ) {
$input = str_split( $input );
$icount = count( $input );
$rsumm = qes2_key( $key );
$result = '';
$xspos = 1;
$xsdisp = 1;
foreach( $input as $letter ) {
$char = ord( $letter ) - ( $rsumm * $xspos ) + $xsdisp ;
$result .= chr( $char );
$xspos++;
$xsdisp += 1;
}
return $result;
}
qes2a encryption (c)
+1
public function cutPoly($business_id)
{
$done = [];
$red = Isochrone::where('business_id', $business_id)->where('color', 'red')->selectRaw('id, color, ST_AsText(path) as p_path')->get()->first();
$blue = Isochrone::where('business_id', $business_id)->where('color', 'blue')->selectRaw('id, color, ST_AsText(path) as p_path')->get()->first();
$green = Isochrone::where('business_id', $business_id)->where('color', 'green')->selectRaw('id, color, ST_AsText(path) as p_path')->get()->first();
if ($red && $blue) {
if (!$red['p_path'] || !$blue['p_path']) {
$done['red'] = 'already';
} else {
$isoString = 'POLYGON((';
$blue_path = $blue['p_path'];
$red_path = $red['p_path'];
if (!array_key_exists('lat', $blue['p_path'][0])) {
$blue_path = $blue['p_path'][0];
}
if (!array_key_exists('lat', $red['p_path'][0])) {
$red_path = $red['p_path'][0];
}
$isoString .= implode(',', array_map(function ($entry) {
return $entry['lat'] . ' ' . $entry['lng'];
}, $red_path))
. '),('.
implode(',', array_map(function ($entry) {
return $entry['lat'] . ' ' . $entry['lng'];
}, $blue_path))
.'))';
Isochrone::where('business_id', $business_id)->where('color', 'red')->update(['path' => \DB::raw("ST_GeomFromText('$isoString')")]);
$done['red'] = 'ok';
}
} else if ($red && $green) {
if (!$red['p_path'] || !$green['p_path']) {
$done['red'] = 'already';
} else {
$isoString = 'POLYGON((';
$green_path = $green['p_path'];
$red_path = $red['p_path'];
if (!array_key_exists('lat', $green['p_path'][0])) {
$green_path = $green['p_path'][0];
}
if (!array_key_exists('lat', $red['p_path'][0])) {
$red_path = $red['p_path'][0];
}
$isoString .= implode(',', array_map(function ($entry) {
return $entry['lat'] . ' ' . $entry['lng'];
}, $red_path))
. '),('.
implode(',', array_map(function ($entry) {
return $entry['lat'] . ' ' . $entry['lng'];
}, $green_path))
.'))';
Isochrone::where('business_id', $business_id)->where('color', 'red')->update(['path' => \DB::raw("ST_GeomFromText('$isoString')")]);
$done['red'] = 'ok green';
}
}
if ($blue && $green) {
if (!$blue['p_path'] || !$green['p_path']) {
$done['blue'] = 'already';
} else {
$isoString = 'POLYGON((';
$green_path = $green['p_path'];
$blue_path = $blue['p_path'];
if (!array_key_exists('lat', $green['p_path'][0])) {
$green_path = $green['p_path'][0];
}
if (!array_key_exists('lat', $blue['p_path'][0])) {
$blue_path = $blue['p_path'][0];
}
$isoString .= implode(',', array_map(function ($entry) {
return $entry['lat'] . ' ' . $entry['lng'];
}, $blue_path))
. '),('.
implode(',', array_map(function ($entry) {
return $entry['lat'] . ' ' . $entry['lng'];
}, $green_path))
.'))';
Isochrone::where('business_id', $business_id)->where('color', 'blue')->update(['path' => \DB::raw("ST_GeomFromText('$isoString')")]);
$done['blue'] = 'ok';
}
}
return $done;
}
Он же через час - три дня будет разбиратся что написал
0
if (!$resp || !is_array($resp) || array_key_exists('error', $resp)) {
// TODO: what to do?
} else {
Log::channel('caridis')->info("***********************NEW_DELIVERY");
Log::channel('caridis')->info([$order]);
$order->caridis_id = $resp['data']['id'];
}
// TODO: what to do?
сука????
0
public class C1834 { }
class C1835 extends C1834 { }
public class C1836 {
public void m5(ArrayList<? extends C1834> strList)
{
List<? extends C1834> list = new ArrayList<>();
list.add(new C1835());
}
}
АААА... кто-нибудь знает почему нельзя добавить объект С1835 в список? Как это обойти?
0
string log = pair;
log += ":";
log += new string(Convert.ToChar(32), 21 - pair.Length); /*spaces*/
+1
<?php
require_once '../vendor/autoload.php';
require_once 'functions.php';
require_once 'KPFile.php';
require_once 'KPLogger.php';
use Intervention\Image\ImageManagerStatic as Шакализатор;
Шакализатор::configure(array('driver' => 'imagick'));
$logger = new KPLogger();
function сжать(KPFile $шакал, $степеньСжатия, Array $ебучесть, $output) {
$индексЕбучести = 0;
if (!is_null($ебучесть[0])) {
$индексЕбучести = $ебучесть[0];
}
if (!is_null($ебучесть[1]) && ($ебучесть[1] > $ебучесть[0])) {
$индексЕбучести = $ебучесть[1];
}
$img = Шакализатор::make($шакал->path);
$img->resize($ебучесть[0], $ебучесть[1], function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
});
if ($img->mime() !== 'image/jpeg') {
$img->encode('jpg', 100);
}
$img->save($output."$шакал->name-$индексЕбучести.jpg", $степеньСжатия);
}
function сжатьВсехШакалов($path, $степеньСжатия, $ебучестьШакалов, $output) {
global $logger;
$files = scandir($path);
foreach($files as $key => $file) {
$logger->colorLogWithFiles('blue', $file, $key);
try {
$шакал = new KPFile($path.$file);
if ($шакал->type !== KPFile::FILE_TYPE_IMAGE) {
continue;
}
if (trim($шакал->name) == '') {
throw new Exception("file=$file, kpFileName=$шакал->name");
}
foreach ($ебучестьШакалов as $ебучесть) {
сжать($шакал, $степеньСжатия, $ебучесть, $output);
}
} catch (Exception $e) {
$logger->exception($e, $key);
}
}
}
$степеньСжатия = 22;
$ебучестьШакалов = [
[60, 60],
[38, 38]
];
сжатьВсехШакалов('dataHeavy/carsOrig/', $степеньСжатия, $ебучестьШакалов, "../public/img/cars/");
$logger->colorLogWithFiles('blue', '10/10 *** еб/шакалов', null, "\n");
shakal of jpeg-street