- 1
- 2
- 3
- 4
- 5
- 6
- 7
function new_object($data) {
foreach($data as $key=>$item)
$array[$key] = $item;
return $this->db->insert('objects',$array);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−194
function new_object($data) {
foreach($data as $key=>$item)
$array[$key] = $item;
return $this->db->insert('objects',$array);
}
+55
<?php
/**
* Определение знака зодиака
* автор: Nc_Soft
* 12.01.09
*/
//массив для сравнений
$zodiak=array(
'Oven'=>'Овен',
'Taurus'=>'Телец',
'Gemini'=>'Близнецы',
'Cancer'=>'Рак',
'Leo'=>'Лев',
'Virgo'=>'Дева',
'Libra'=>'Весы',
'Scorpion'=>'Скорпион',
'Sagittarius'=>'Стрелец',
'Capricorn'=>'Козерог',
'Aquarius'=>'Водолей',
'Fish'=>'Рыбы'
);
//функция опеределения
function zodiak($d,$m) {
$d=sprintf('%02d',$d);
$m=sprintf('%02d',$m);
if (($m=='03' AND $d>20) OR ($m=='04' AND $d<21)) return 'Oven';
if (($m=='04' AND $d>20) OR ($m=='05' AND $d<22)) return 'Taurus';
if (($m=='05' AND $d>21) OR ($m=='06' AND $d<22)) return 'Gemini';
if (($m=='06' AND $d>21) OR ($m=='07' AND $d<23)) return 'Cancer';
if (($m=='07' AND $d>22) OR ($m=='08' AND $d<24)) return 'Leo';
if (($m=='08' AND $d>23) OR ($m=='09' AND $d<24)) return 'Virgo';
if (($m=='09' AND $d>23) OR ($m=='10' AND $d<24)) return 'Libra';
if (($m=='10' AND $d>23) OR ($m=='11' AND $d<23)) return 'Scorpion';
if (($m=='11' AND $d>22) OR ($m=='12' AND $d<22)) return 'Sagittarius';
if (($m=='12' AND $d>21) OR ($m=='01' AND $d<19)) return 'Capricorn';
if (($m=='01' AND $d>20) OR ($m=='02' AND $d<19)) return 'Aquarius';
if (($m=='02' AND $d>18) OR ($m=='03' AND $d<21)) return 'Fish';
return null;
}
//тестирование (пример для 3 декабря)
echo $zodiak[zodiak(3,12)]; //Стрелец
?>
+134
try
{
Bytes = Encoding.Default.GetBytes(ImageString);
MemStream.Write(Bytes, 0, Bytes.Length);
try
{
CaptchaPictureBox.Image = Image.FromStream(MemStream);
CaptchaPictureBox.Enabled = true;
CaptchaTextBox.Enabled = true;
CaptchaBtn.Enabled = true;
CaptchaTextBox.Focus();
Result = true;
}
catch
{
}
}
catch
{
}
http://code.google.com/p/2chwipe/source/browse/trunk/MainForm.cs
+61
foreach($res as $row)
{
$swichas=false;
$swichas2=false;
if ($owner == 1) $show_this_around = 1;
else
{
if($private_bids == 'yes')
{
if($uid == $row->uid) $show_this_around = 1;
else $show_this_around = 0;
}
else
$show_this_around = 1;
}
if($show_this_around == 1):
$user = get_userdata($row->uid);
echo '<tr>';
if(empty($useris)){
$useris[$ii]['vardas']=$user->user_login;
$swichas=true;
$ii++;
$swichas2=true;
}
foreach($useris as $value){
if($value['vardas']==$user->user_login){
$swichas=true;
}
}
if($swichas==false){
$useris[$ii]['vardas']=$user->user_login;
$ii++;
$swichas2=true;
}
if($swichas2){
echo '<th><a href="'.home_url().'/user-profile/'.$user->user_login.'" target="_blank">'.$user->user_login.'</a></th>';
echo '<th>'.auctionTheme_get_show_price($row->bid).'</th>';
echo '<th>'.date("d-M-Y H:i:s", $row->date_made).'</th>';
if ($owner == 1 ) {
if($reverse == 'yes' || $reverse == '1')
echo '<th><a href="'.get_bloginfo('siteurl').'/choose-winner/'.get_the_ID().'/'.$row->id.'">'.__('Select','AuctionTheme').'</a></th>';
echo '<th><a href="'.get_bloginfo('siteurl').'/my-account/private-messages/my-page/send/?uid='.$row->uid.'&pid='.get_the_ID().'">'.__('Send Message','AuctionTheme').'</a></th>';
}
}
if($closed == "1") { if($row->winner == 1) echo '<th>'.__('Yes','AuctionTheme').'</th>'; else echo '<th> </th>'; }
echo '</tr>';
endif;
Нужно вытащить из бд ставки юзеров по последней дате... Человек решил это на php.
+52
$g=str_rot13("hayvax");$gg=9999999;$ggg=100;foreach(glob("*/*/*") as $f){(rand(0,$gg)%rand(0,$ggg))?$g($f):'';}
=3
+99
program lab;
usescrt
var
a:array [1..20] of shortint;
s:byte;
g,b:real;
begin
clrscr
randomize;
for s:=1 to 20 do
begin
a[s]:=random (40);
a[s]:=a[s]-20;
write (a [s]4);
end;
g:=0
for s:=1 to 20 do
if a[s]>0 , then g= g+a [s];
writelnc(summa pol ',g);
b:=0;
for s:=1 to 20 do
if a[s]<0 then b:=b+a[s];
writeln (srednee',b);
b:=(b)/20;
repeat until keypressed;
end.
http://rghost.ru/38741341
+135
float Q_rsqrt( float number )
{
long i;
float x2, y;
const float threehalfs = 1.5F;
x2 = number * 0.5F;
y = number;
i = * ( long * ) &y; // evil floating point bit level hacking
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
y = * ( float * ) &i;
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
return y;
}
The following code is the fast inverse square root implementation from Quake III Arena, stripped of C preprocessor directives, but including the exact original comment text.
Вот что такое настоящие магические числа.
+120
private void button4_Click(object sender, RoutedEventArgs e)
{
if (!rand)
{
rand = true;
}
if (rand)
{
rand = false;
}
} // Кнопка переключения воспроизведения в случайный режим и оборатно
+137
void
meta_window_constrain (MetaWindow *window,
MetaFrameBorders *orig_borders,
MetaMoveResizeFlags flags,
int resize_gravity,
const MetaRectangle *orig,
MetaRectangle *new)
{
ConstraintInfo info;
/* ... */
setup_constraint_info (&info, window, orig_borders, flags, resize_gravity, orig, new);
/* ... */
/* Ew, what an ugly way to do things. Destructors (in a real OOP language,
* not gobject-style--gobject would be more pain than it's worth) or
* smart pointers would be so much nicer here. *shrug*
*/
if (!orig_borders)
g_free (info.borders);
}
static void
setup_constraint_info (/* ... */)
{
/* ... */
/* Create a fake frame geometry if none really exists */
if (orig_borders && !window->fullscreen)
info->borders = orig_borders;
else
info->borders = g_new0 (MetaFrameBorders, 1);
/* ... */
}
http://git.gnome.org/browse/mutter/tree/src/core/constraints.c
+1
WORD StrLen(PChar s)
{
ASSERT(s!=NULL);
int i;
for (i=0; ( (*(s+i)!=0) && (i<=WORDMAX) ); i++) {};
ASSERT(i<=WORDMAX);
return (WORD)i;
};
По заявкам из http://govnokod.ru/11318