- 1
- 2
- 3
<?php
echo (int) ((0.1 + 0.7) * 10);
?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+98
<?php
echo (int) ((0.1 + 0.7) * 10);
?>
Похопе меня пугает
http://ideone.com/gVnkep
+54
public function accuire($array = array()) {
return $this->acquire($array);
}
public function acquire($array = array()) {
Spell-master
+137
private void SetRowColor()
{
DataGridView dg = new DataGridView();
dg.Sorted += new EventHandler(DataGridView1_Sorted);
foreach (DataGridViewColumn col in DataGridView1.Columns)
{
if (col is DataGridViewTextBoxColumn)
{
if (col.HeaderText == "Status")
{
foreach (DataGridViewRow dgRow in DataGridView1.Rows)
{
if (dgRow.Cells[col.Index].Value.ToString() == "0" || dgRow.Cells[col.Index].Value.ToString() == "Inactive")
{
DataGridViewCellStyle dStyle = new DataGridViewCellStyle();
dStyle.BackColor = Color.Goldenrod;
dStyle.Padding = new System.Windows.Forms.Padding(3, 0, 0, 0);
dgRow.DefaultCellStyle = dStyle;
}
}
}
if (col.HeaderText == "StatusID")
{
foreach (DataGridViewRow dgRow in DataGridView1.Rows)
{
if (dgRow.Cells[col.Index].Value.ToString() == "0" || dgRow.Cells[col.Index].Value.ToString() == "Inactive")
{
DataGridViewCellStyle dStyle = new DataGridViewCellStyle();
dStyle.BackColor = Color.Goldenrod;
dStyle.Padding = new System.Windows.Forms.Padding(3, 0, 0, 0);
dgRow.DefaultCellStyle = dStyle;
}
}
}
}
//if (DataGridView1.Columns[i].ValueType == typeof(System.DateTime) && DataGridView1.Columns[i].Name != "CreateTS" && DataGridView1.Columns[i].Name != "ModifyTS" && DataGridView1.Columns[i].Name != "InactiveTS" && DataGridView1.Columns[i].Name != "PrintedTS")
//{
// DataGridView1.Columns[i].DefaultCellStyle.Format = m_strDateFormat;
// DataGridView1.Columns[i].Width = m_strDateFormat == "dd MMM yyyy hh:mm:ss tt" ? 150 : DataGridView1.Columns[i].Width;
//}
//DataGridView1.Columns[i].DefaultCellStyle.
}
}
Новая работа. WinForms.
90% примерно такое.
+149
document.getElementById('out').value = document.getElementById('in').value.toString().translit().split(' ').join('_').toString().toLowerCase()
translit() видимо самописный...
−107
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 6;
}
-(UITableViewCell *) tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *kCellIdentifier = @"";
switch (indexPath.row)
{
case 0:
kCellIdentifier = @"SpaceCell";
break;
case 1:
kCellIdentifier = @"LoginCell";
break;
case 2:
kCellIdentifier = @"PasswordCell";
break;
case 3:
kCellIdentifier = @"EmailCell";
break;
case 4:
kCellIdentifier = @"BirhtdayCell";
break;
default:
kCellIdentifier = @"ForgotCell";
break;
}
UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.backgroundColor = [UIColor clearColor];
cell.backgroundView.backgroundColor = [UIColor clearColor];
if (indexPath.row == 1)
{
[self backgroundCells:cell fileImage:@"top_downlayer.png"];
self.loginTextField.text = userName;
self.loginTextField.placeholder = @"User Name";
self.loginTextField.frame = CGRectMake(10.0f, 10.0f, 300.0f, 30.0f);
[cell.contentView addSubview:self.loginTextField];
}
else if (indexPath.row == 2)
{
[self backgroundCells:cell fileImage:@"middle_downlayer.png"];
self.passwordTextField.text = password;
self.passwordTextField.placeholder = @"Password";
self.passwordTextField.frame = CGRectMake(10.0f, 8.0f, 300.0f, 30.0f);
[cell.contentView addSubview:self.passwordTextField];
}
else if (indexPath.row == 3)
{
[self backgroundCells:cell fileImage:@"middle_downlayer.png"];
self.email.text = emailString;
self.email.placeholder = @"Email";
self.email.frame = CGRectMake(10.0f, 7.0f, 300.0f, 30.0f);
[cell.contentView addSubview:self.email];
}
else if (indexPath.row == 4)
{
[self backgroundCells:cell fileImage:@"middle_downlayer.png"];
UIImageView *inputIV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"input_login.png"]];
inputIV.frame = CGRectMake(20, 8, 280, 28);
[inputIV setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[cell addSubview:inputIV];
[inputIV release];
if (![resultsDate.text length])
{
UILabel *birhtdayLabel = [[UILabel alloc] initWithFrame:CGRectMake(29, 12, 150, 20)];
birhtdayLabel.text = @"Birthday";
[birhtdayLabel setTextAlignment:UITextAlignmentLeft];
[birhtdayLabel setFont: [UIFont fontWithName:@"Arial" size:17.0f]];
[birhtdayLabel setTextColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:0.25]];
[birhtdayLabel setHighlightedTextColor:[UIColor whiteColor]];
[birhtdayLabel setBackgroundColor:[UIColor clearColor]];
[birhtdayLabel setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[cell addSubview:birhtdayLabel];
[birhtdayLabel release];
}
else
[cell addSubview:resultsDate];
}
else if (indexPath.row == 5)
{
[self backgroundCells:cell fileImage:@"down_downlayer.png"];
UIImage *buttonBackgroundPressed = [UIImage imageNamed:@"search_btn_act.png"];
UIImage *buttonBackground = [UIImage imageNamed:@"search_btn.png"];
UIButton *singUpButton = [CustomButton buttonWithTitle:@"SIGN UP" target:self selector:@selector(singUpTouchAction:) frame:CGRectMake(20, 6, 280, 28) image:buttonBackground imagePressed:buttonBackgroundPressed];
singUpButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
singUpButton.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[cell addSubview:singUpButton];
}
return cell;
}
Старый проект. Открыл класс наугад.
Так кто-то строил форму для регистрации юзера. Каждое поле в форме - уникально.
+62
$data['date'] = date('Y'.'-'.'m'.'-'.'d'.' '.'G'.':'.'m'.':'.'s');
+129
static int multipart_buffer_eof(multipart_buffer *self TSRMLS_DC)
{
if ( (self->bytes_in_buffer == 0 && fill_buffer(self TSRMLS_CC) < 1) ) {
return 1;
} else {
return 0;
}
}
+148
function mouseHover(state) {
var row = window.event.srcElement;
row.style.cursor='hand';
var colorChange = ((state == "over") ? "#ff0000" : "");
row.style.color = colorChange;
var textChange = ((state == "over") ? "underline" : "none");
row.style.textDecoration = textChange;
}
Где-то в Html
<DIV onmouseover="mouseHover('over')" onmouseout="mouseHover('out')">
Из странички отчёта Microsoft SCCM
+57
function attribute( $attr ) {
if( method_exists( $this, $attr ) ) {
return $this->$attr();
}
return $this->$attr();
}
Видимо сначало было без проверки.
+56
function isAvailable( $args ) {
$available = fetchAvailability( $args );
return $available ? 'yep' : 'noup';
}
// Где-то в javascript после вызова isAvailable()
function isAvailableCallback( result ) {
if ( result === 'yep' ) {
...
}
}
Альтернативный способ работы с логическим типом данных. Используется как и в javascript так и в php.