- 1
- 2
- 3
- 4
- 5
fi = fopen("kokoko.tmp", "rb");
fseek(fi, 0, SEEK_END);
file_size = ftell(fi);
fseek(fi, 0, SEEK_SET);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+131
fi = fopen("kokoko.tmp", "rb");
fseek(fi, 0, SEEK_END);
file_size = ftell(fi);
fseek(fi, 0, SEEK_SET);
rewind? system call? Не, не слышали.
+155
try
{
return ($image = $this->row->image()->first())
? $image->{$this->imageAlias}
: dummyThumbnail($this->imageAlias)
;
}
catch(\Exception $e)
{
if ($e->getMessage() === 'Method [image] is not defined on the Query class.')
{
$val = parent::value();
return (is_string($val) and \Str::contains($val, 'http://'))
? $val
: $this->row->getImageSrc($this->name, $this->imageAlias)
;
}
throw new \Exception($e->getMessage(), $e->getCode());
}
+143
const int index64[64] = {
0, 1, 48, 2, 57, 49, 28, 3,
61, 58, 50, 42, 38, 29, 17, 4,
62, 55, 59, 36, 53, 51, 43, 22,
45, 39, 33, 30, 24, 18, 12, 5,
63, 47, 56, 27, 60, 41, 37, 16,
54, 35, 52, 21, 44, 32, 23, 11,
46, 26, 40, 15, 34, 20, 31, 10,
25, 14, 19, 9, 13, 8, 7, 6
};
/**
* bitScanForward
* @author Martin Läuter (1997)
* Charles E. Leiserson
* Harald Prokop
* Keith H. Randall
* "Using de Bruijn Sequences to Index a 1 in a Computer Word"
* @param bb bitboard to scan
* @precondition bb != 0
* @return index (0..63) of least significant one bit
*/
int bitScanForward(U64 bb) {
assert (bb != 0);
return index64[((bb & -bb) * 0x03f79d71b4cb0a89) >> 58];
}
нашёл на кывте
+114
// FxCop does not allow the string "Uri" in a method name that does not return a Uri object.
public static string To_U_r_i_TypeString(DeviceType type)
+121
(reverse (butlast ...))
Родное :)
−6
хде хруст?
Превед, говнокод. Чому нет категории для раста?
0
void SoftSPIB::setClockDivider(uint8_t div) {
if (div == SPI_CLOCK_DIV2) _delay = 2;
else if (div == SPI_CLOCK_DIV4) _delay = 4;
else if (div == SPI_CLOCK_DIV8) _delay = 8;
else if (div == SPI_CLOCK_DIV16) _delay = 16;
else if (div == SPI_CLOCK_DIV32) _delay = 32;
else if (div == SPI_CLOCK_DIV64) _delay = 64;
else if (div == SPI_CLOCK_DIV128) _delay = 128;
else _delay = 128;
}
uint8_t SoftSPIB::transfer(uint8_t val) {
...
uint8_t del = _delay >> 1;
uint8_t bval = 0;
for (uint8_t bit = 0; bit < 8; bit++) {
digitalWrite(_sck, _ckp ? LOW : HIGH);
for (uint8_t i = 0; i < del; i++) {
asm volatile("nop");
}
if (...) {...} else {
digitalWrite(_mosi, val & (1<<bit) ? HIGH : LOW);
}
...
...
...
}
return out;
}
- А это точно частота CLOCK_DIV2? /* Fosc/2 */
- Не боись, я все рассчитал!
+1
public class ExampleW{
public static void main(){
Scanner input = new Scanner(System.in);
System.out.println("Give mark: ");
int mark = input.nextInt();
String Grade;
switch (mark){
case 100:
case 99:
case 98:
case 97:
case 96:
case 95:
case 94:
case 93:
case 92:
case 91:
case 90:{
Grade = "A+";
break;
}case 89:
case 88:
case 87:
case 86:
case 85:
case 84:
case 83:
case 82:
case 81:
case 80: {
Grade = "A";
break;
}case 75:
case 76:
case 77:
case 78:
case 79:{
Grade = "A-";
break;
}case 70:
case 71:
case 72:
case 73:
case 74:{
Grade ="B+";
break;
} case 69:
case 68:
case 67:
case 66:
case 65:{
Grade ="B";
break;
}
case 64:
case 63:
case 62:
case 61:
case 60:{
Grade = "C+";
break;
}case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
case 58:
case 59: {
Grade = "C";
break;
}case 45:
case 46:
case 47:
case 48:
case 49:{
Grade = "D";
break;
}case 40:
case 41:
case 42:
case 43:
case 44:{
Grade = "E";
break;
}case 0:
case 1:
case 2:
case 3:
...
...
}default: {
Grade = "null";
break;
}}
}
+1
#include <iostream>
#include <functional>
#define STD_FUNCTION(a, ...) typeof( a (*) __VA_ARGS__ )
template<typename T>
T do_op_t(T a, T b, STD_FUNCTION(T,(T,T)) op)
{
return op(a,b);
}
template
<
typename T,
STD_FUNCTION(
T,
(
T,T,
STD_FUNCTION(
T,
(T,T)
)
)
) F1,
STD_FUNCTION(
T,
(T,T)
) F2
>
T do_op_spec(T a, T b)
{
return F1(a, b, F2);
}
int add(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
std::function<int(int,int)> fnc = \
do_op_spec\
<
int,
do_op_t<int>,
add
>;
int main()
{
std::cout << do_op_t<int>(9, 9, add) << "\n";
std::cout << do_op_t<int>(9, 9, mul) << "\n";
std::cout << do_op_spec<int, do_op_t<int>,add>(9,9) << "\n";
std::cout << do_op_spec<int, do_op_t<int>,mul>(9,9) << "\n";
std::cout << fnc(9,9) << "\n";
}
Какая крестопараша )))
0
p "Какой багор )))"
puts "Какой багор )))"
Какой багор )))