- 1
[Объектно Ориентировочное Программирование]
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+140
[Объектно Ориентировочное Программирование]
Статус в соц. сети одного кулхацкера
+148
for($i = 5; $i <= 11; $i++)
{
echo "<tr>\n";
echo "<td valign=\"top\">\n<b>$i</b>\n</td>\n\n";
/* для каждого дня */
foreach($dayslt as $day)
{
echo "<td>\n";
for($lesson_num = 1; $lesson_num <= 6; $lesson_num++)
{
echo "<input type=\"text\" name=\"lesson[$i][$day][$lesson_num]\"><br/>\n";
}
echo "</td>\n\n";
}
echo "</tr>\n\n";
}
какая-то хуйня по вводу расписания, хз
+98
template<unsigned AxesQount, class Conten>
const Vector<AxesQount, Conten> Vector<AxesQount, Conten>::operator-(void) const
{
return *this*-1.0;
};
template<unsigned AxesQount, class Conten>
const Vector<AxesQount, Conten> Vector<AxesQount, Conten>::operator+(void) const
{
return *this;
};
Чужой велосипед. Пытался использовать в своём проекте, но передумал.
0
include( 'includes/systems/header.inc' ); #Подключение Заголовка
@list($wdth,$hght) = getImageSize( $_GET['photo'] );
while( ( $wdth > $_SESSION['wdth']-100 ) || ( $hght > $_SESSION['hght']-100 ) ){
$wdth = $wdth / 1.00001;
$hght = $hght / 1.00001;
}
# echo $wdth . 'x' . $hght ;
# $hghtP = $hght - 85;
# $wdthP = $wdth - 85;
$hghtP = $hght;
$wdthP = $wdth;
@$prms = ( $wdth > $hght )? 'width=' . (int)$wdthP: 'height=' . (int)$hghtP;
# echo $wdth . 'x' . $hght;
photo.php
0
def res_horizontal(self, btn):
self.im = Image.open(self.new_img)
if btn.text() == "320x240":
self.new_im = self.im.resize((320, 240))
elif btn.text() == '1024x600':
self.new_im = self.im.resize((1024, 600))
elif btn.text() == '1280x720':
self.new_im = self.im.resize((1280, 720))
elif btn.text() == '1440x900':
self.new_im = self.im.resize((1440, 900))
elif btn.text() == '1600x1024':
self.new_im = self.im.resize((1600, 1024))
elif btn.text() == '1920x1080':
self.new_im = self.im.resize((1920, 1080))
elif btn.text() == '2048x1536':
self.new_im = self.im.resize((2048, 1536))
elif btn.text() == '2560x1440':
self.new_im = self.im.resize((2560, 440))
elif btn.text() == '3840x2160':
self.new_im = self.im.resize((3840, 2160))
elif btn.text() == '4096x2160':
self.new_im = self.im.resize((4096, 2160))
elif btn.text == '800x480':
self.new_im = self.im.resize((800, 480))
self.new_im.save(self.new_img)
def res_vertical(self, btn):
self.im = Image.open(self.new_img)
if btn.text() == '240x320':
self.new_im = self.im.resize((240, 320))
elif btn.text() == '480x800':
self.new_im = self.im.resize((480, 800))
elif btn.text() == '600x1024':
self.new_im = self.im.resize((600, 1024))
elif btn.text() == '720x1280':
self.new_im = self.im.resize((720, 1280))
elif btn.text() == '900x1440':
self.new_im = self.im.resize((900, 1440))
elif btn.text() == '1024x1600':
self.new_im = self.im.resize((1024, 1600))
elif btn.text() == '1080x1920':
self.new_im = self.im.resize((1080, 1920))
elif btn.text() == '1536x2048':
self.new_im = self.im.resize((1536, 2048))
elif btn.text() == '1440x2560':
self.new_im = self.im.resize((1440, 2560))
elif btn.text() == '2160x3840':
self.new_im = self.im.resize((2160, 3840))
elif btn.text() == '2160x4096':
self.new_im = self.im.resize((2160, 4096))
self.new_im.save(self.new_img)
def res_square(self, btn):
self.im = Image.open(self.new_img)
if btn.text() == '320x320':
self.new_im = self.im.resize((320, 320))
elif btn.text() == '800x800':
self.new_im = self.im.resize((800, 800))
elif btn.text() == '1280x1280':
self.new_im = self.im.resize((1280, 1280))
elif btn.text() == '1024x1024':
self.new_im = self.im.resize((1024, 1024))
elif btn.text() == '1600x1600':
self.new_im = self.im.resize((1600, 1600))
elif btn.text() == '1440x1440':
self.new_im = self.im.resize((1440, 1440))
elif btn.text() == '1920x1920':
self.new_im = self.im.resize((1920, 1920))
elif btn.text() == '2048x2048':
self.new_im = self.im.resize((2048, 2048))
elif btn.text() == '3840x3840':
self.new_im = self.im.resize((3840, 3840))
elif btn.text() == '2560x2560':
self.new_im = self.im.resize((2560, 2560))
elif btn.text() == '4096x4096':
self.new_im = self.im.resize((4096, 4096))
self.new_im.save(self.new_img)
Давным давно на pyqt писал этот говнокод, теперь ржу над ним
+2
Inductive my_bool :=
| my_false
| my_true.
Theorem shit_happens:
(if my_false then 42 else 100500) = 42.
Proof.
reflexivity.
Qed.
Какая типизация )))
+2
match group_shapes():
case [], [point := Point(x, y), *other]:
print(f"Got {point} in the second group")
process_coordinates(x, y)
https://www.python.org/dev/peps/pep-0622/
0
//библиотеки cuda_runtime.h и device_launch_parameters.h
//для работы с cyda
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include<vector>
#include<string>//для getline
#include <stdio.h>
#include<fstream>
using namespace std;
__global__ void Upload_to_GPU(unsigned long long *Number,unsigned long long *Stepn, bool *Stop,unsigned long long *INPUT,unsigned long long *max) {
int thread = threadIdx.x;
unsigned long long MAX_DEGREE_OF = max[0];
int X = thread;
unsigned long long Calculated_number = 1;
unsigned long long Current_degree_of_number = 2;
unsigned long long Original_numberP = INPUT[0];
Stop[thread] = false;
bool BREAK = false;
if (X!=0&&X!=1) {
while (!BREAK) {
if (Current_degree_of_number <= MAX_DEGREE_OF) {
Calculated_number = 1;
for (int counter = 0; counter < Current_degree_of_number; counter++) {
Calculated_number *=X;
}
if (Calculated_number == Original_numberP) {
Stepn[thread] = Current_degree_of_number;
Number[thread] = X;
Stop[thread] = true;
BREAK = true;
}
Current_degree_of_number++;
}
else { BREAK = true; }
}
}
}
https://habr.com/post/525892/
> Сравнение времени выполнения алгоритма на CPU и GPU
+1
/// Checks if the token is number or not
bool is_number(char* test_val)
{
const char* ROW = "0123456789\0";
for (int i = 0; i < strlen(test_val); i++) {
for (int j = 0; j < strlen(ROW); j++) {
if (test_val[i] == ROW[j]) {
goto next;
}
}
return false;
next:
}
return true;
}
Попытка проверить строку на число в Си.
0
try
{
await storageClient.DownloadObjectAsync(Bucket, fileName, stream).ConfigureAwait(false);
}
catch(Exception ex)
{
throw new FileStorageException($"File '{fileName}' not found in a bucket '{Bucket}'", ex) { StatusCode = StatusCodes.Status404NotFound };
}
Сеньйор дот нет девелопер