/** * lowercase letters */
        $this->store['upper_Spec'] = array( *cut* );
        /** * uppercase letters */
        $this->store['lower_Spec'] = array( *cut* );
      
                    } else {
                      $errmsg='An unknown error occured.';
                    }
                  } else {
                    $errmsg='The passwords you entered do not match';
                  }
                } else {
                  $errmsg='Password has to be at least 8 characters long.';
                }
              } else {
                $errmsg='The email you entered is already in our database.';
              }
            } else {
              $errmsg='Please enter your email address.';
            }
          } else {
            $errmsg='Please enter your first name and your last name.';
          }
        } else {
        (...)
      
        // Happy debugging, suckers
        # define true (rand() > 10)
      

anonymous

0

#if you edit these lines you will get the curse of amazonian indian
-- begin of weird multidimensional mindfuck spaguetti code --
 

anonymous

0

$foo = $foo; // DO NOT remove this, it will break EVERYTHING
// ... Fuck, that really did break everything
 

anonymous

0

if (optionQ != "undefined" && optionQ == "true")
 

anonymous

0

function GETTER_FOR($property) { return 'get'.$property; }
 

0

// how to check if a string is a valid dollar amount

        var str = $('#priceField').val();
        var res;
        res = str.substring(1, 0);
 
        if (res != "$" && res.length > 0) {
            str = "$" + str;
            var res1 = str.substring(str.length, 1);
 
            if (res1.length > 0) {
                var chk1 = res1.split('.');
                if (chk1.length > 1) {
                    if (!$.isNumeric(chk1[0])) {
                        alert('Please enter valid amount.');
                        return false;
                    }
                    if (chk1[1] != '') {
                        if (chk1[1].length > 2) {
                            alert('Please enter valid amount.');
                            return false;
                        }
                        else {
                            if (!$.isNumeric(chk1[1])) {
                                alert('Please enter valid amount.');
                                return false;
                            }
                        }
                    }
                    else {
                        alert('Please enter valid amount.');
                        return false;
                    }
                }
                else {
 
                    if (!$.isNumeric(chk1[0])) {
                        alert('Please enter valid amount.');
                        return false;
                    }
                }
            }
            else {
                if (res.length > 0) {
                    alert('Please enter valid amount.');
                    return false;
                }
            }
        }
        else {
            var res1 = str.substring(str.length, 1);
 
            if (res1.length > 0) {
                var chk1 = res1.split('.');
                if (chk1.length > 1) {
                    if (!$.isNumeric(chk1[0])) {
                        alert('Please enter valid amount.');
                        return false;
                    }
                    if (chk1[1] != '') {
                        if (chk1[1].length > 2) {
                            alert('Please enter valid amount.');
                            return false;
                        }
                        else {
                            if (!$.isNumeric(chk1[1])) {
                                alert('Please enter valid amount.');
                                return false;
                            }
                        }
                    }
                    else {
                        alert('Please enter valid amount.');
                        return false;
                    }
                }
                else {
 
                    if (!$.isNumeric(chk1[0])) {
                        alert('Please enter valid amount.');
                        return false;
                    }
                }
            }
            else {
                if (res.length > 0) {
                    alert('Please enter valid amount.');
                    return false;
                }
            }
        }
 

0

$sqlinjection = false;

[a piece of code that modifies different variable]

if ($sqlinjection)
{
    echo 'Attack attempt detected';
}
 

+1

if (preg_match("/delete from|update|insert into|create|alter table|alter column|drop table|drop column|execute|shutdown(...)/i", $string)) {
        exit('Attack attempt detected!');
}
 

0

int result = uow.Db.UpsertDetails(1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 1);
 

anonymous

0

'''The job was to create a calculator which get an expression like this
3+4*4^(12-3) as argument and calculate it, our teacher sad we can use any programing language,
this is my solution'''

import os, sys
os.system('python -c "print ' + sys.argv[1].replace('^', '**') + '"')
 

anonymous

+1

#define ZERO 512
 

+2

private bool ValidateDate()
{
    try
    {
        DateTime date;
        if (DateTime.TryParse(txtFechaCalculo.Text, out date))
        {
            return true;
        }
        else
        {
            throw new Exception("Invalid Date");
        }
    }
    catch (Exception ex)
    {
        return false;
    }
}
 

anonymous

0

i32 AaCpuAtomicSwap32(TAaCpuAtomic32* atomic, i32 value)
{
i32 prev;

/** @todo Implement to be really atomic operation */

prev = atomic->data;
atomic->data = value;

return prev;
} /* AaCpuAtomicCmpSwap32 */
 

anonymous

+1

try {
            ...
        } catch (Exception e) {
            try {
                throw e;
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
 

anonymous

0

$price = '';
        foreach($orderItemBasket as $p) {
            $price .= "(".$p->getValue().'*';
            if($p->getProduct()->getProposedPrice() == ''){
                $price .= '0)+';
            }
            else{
                $price .= $p->getProduct()->getProposedPrice().')+';
            }

        }
$price = (substr($price, 0, -1));
echo eval($price);
 

anonymous

0

config.camray_z_threshold_that_needs_a_descriptive_name = cos(135.f * 3.14159265f / 180.f);    // todo
 

anonymous

+2

# I know explicit is better than implicit, but...

def process_results(results=None, **kwargs):
    if results is None:
        results = None

    # other stuff
 

+4

// taken from graphael: https://github.com/DmitryBaranovskiy/g.raphael/blob/master/g.raphael.js#L303
this.attr(this.attrs.x ? 'x' : 'cx', x + h + d + (!center ? this.type == 'text' ? bb.width : 0 : bb.width / 2)).attr('y', center ? y : y - bb.height / 2);
 

anonymous

+8

// 3/12/2014 - Removed sleep for faster load time
//sleep(2);
 

+2

# How NOT to use auto-complete of your IDE; grep ROAException

    def get_renderer(self):
        """
        Cf from rest_framework.renderers import JSONRenderer
        """
        if ROA_FORMAT == 'json':
            return JSONRenderer()
        elif ROA_FORMAT == 'xml':
            return XMLRenderer()
        elif ROAException == 'yaml':
            return YAMLRenderer()
        else:
            raise NotImplementedError
 

anonymous

+1

	public static String dateFormatInString(Date date) {
		StringBuilder timeStr = new StringBuilder();
		if (date != null) {
			StringBuilder hours = new StringBuilder();
			StringBuilder minutes = new StringBuilder();
			
			Calendar calendar = Calendar.getInstance();
			calendar.setTime(date);
			hours.append(String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)));
			minutes.append(String.valueOf(calendar.get(Calendar.MINUTE)));
			if (hours.length() < 2) {
				hours = new StringBuilder("0").append(hours);	
			}
			if (minutes.length() < 2) {
				minutes = new StringBuilder("0").append(minutes);
			}
			timeStr.append(hours).append(":").append(minutes);
		}
		return timeStr.toString();
	}
 

anonymous

-5

$some_array=array();
if( count($some_array) > 0 ) {
    //around 50 lines of code
} else {
    //more code
}
 

-6

//This was in some code I found on stack overflow, the code works but issues like this made me have to rewrite it entirely for my own use.

entryName.length() > (relPath.length() + "/".length()/*As if the length of "/" will ever fluctuate.*/)
 

anonymous

+4

def very_dirtily_find_configured_ipv6_address_for_interface( interface ):
   try:
       dbg('finding /etc/network/interfaces ipv6 block for interface %s' % interface)
       addr=subprocess.Popen(['sed', '-n', '-e', '/iface[[:space:]]*%s[[:space:]]*inet6/,/^[[:space:]]*iface\|auto/ { /address/ { s/^[[:space:]]*address[[:space:]]*\([0-9a-f.:]*\)/\\1/p } } ' % interface , '/etc/network/interfaces'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].strip()
       prefix=subprocess.Popen(['sed', '-n', '-e', '/iface[[:space:]]*%s[[:space:]]*inet6/,/^[[:space:]]*iface\|auto/ { /netmask/ { s/^[[:space:]]*netmask[[:space:]]*\([0-9]*\)/\\1/p } } ' % interface , '/etc/network/interfaces'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].strip()
       dbg('found /etc/network/interfaces ipv6 block for interface %s: %s/%s' % (interface,addr,prefix))
       return IPy.IP("%s/%s" % (addr, prefix))
   except:
       dbg('something bitterly exploded while trying to find address for interface %s' % interface)
 

anonymous

-1

##All you really need to know about this function (I've cut the most of the stuff between the braces) is that IT IS 1313 LINES LONG!!!
sub determine_access {

  # This query looks up students registered for a range of classes in a
  # given department.

  return %access;
}
 

+3

// codecrap.com: just the funny parts of the code
template <class T>
class SomeInterface: public SomeAbstractInterface
{
 public:
  int writeValue(unsigned int offset, unsigned int value)
  {
    unsigned int data = *(sharedAddress + offset);  //LINE1
  }
  int writeValue(unsigned int offset, int value)
  {
    unsigned int data = *(sharedAddress + offset);  //LINE2
  }
  int writeValue(unsigned int offset, float value)
  {
    *(sharedAddress + offset) = (float)(data + value);  //LINE3
  }
 private:
  T* sharedAddress;
};

// codecrap.com: actual comment in the header file
/*
There is a small problem in this class. The offset values are defined to be int.
where as the address the can be short or int. Since we add the offset to the 
address pointer the compiler may give a warning that you are trying to add a int
value to the possible short. But we cannot avoid this since the in the abstract 
(...) interface class, I have defined them as int. This kind of range checking 
is done in the (...), hence logically there should not be any problem and we can
ignore the compiler warning.
*/

// codecrap.com: compiler "warnings" to be ignored!
__FILE__: In member function 'int SomeInterface<T>::writeValue(unsigned int, unsigned int) [with T = float]':
__FILE__:LINE1: warning: converting to 'unsigned int' from 'float'
__FILE__: In member function 'int SomeInterface<T>::writeValue(unsigned int, int) [with T = float]':
__FILE__:LINE2: warning: converting to 'unsigned int' from 'float'
__FILE__: In member function 'int SomeInterface<T>::writeValue(unsigned int, float) [with T = short unsigned int]':
__FILE__:LINE3: warning: converting to 'short unsigned int' from 'float'
__FILE__: In member function 'int SomeInterface<T>::writeValue(unsigned int, float) [with T = long long unsigned int]':
__FILE__:LINE3: warning: converting to 'long long unsigned int' from 'float'
__FILE__: In member function 'int SomeInterface<T>::writeValue(unsigned int, float) [with T = unsigned int]':
__FILE__:LINE3: warning: converting to 'unsigned int' from 'float'
 

anonymous

+2

            Func<int, IEnumerable<Employee>> getEmps = new Func<int, IEnumerable<Employee>>( ( c) => { for (int i = 0; i < c; i++) { yield return new Employee(); } return new List<Employee>(); });
 

+5

// We need sleep to get two different random seeds and therefore signatures
// if we have two close calls of this code
sleep(1);
srand (time(NULL));
int signature = rand() % MAX_CONS;
 

anonymous

+3

static const unsigned char _saltBytes[] = { 103, 80, 173, 166, 40, 54, 136, 141 };
static const string _salt = reinterpret_cast< const char* >( _saltBytes );
 

anonymous

+8

# Taken from Colout utility.
# By the way, it is awesome, despite some spaghetti code.
# https://nojhan.github.io/colout/

    if len(argv) >= 3:
        color = argv[2]
        if len(argv) >= 4:
            style = argv[3]
            if len(argv) == 5:
                on_groups = bool(argv[4])
                if len(argv) == 6:
                    as_colormap = bool(argv[5])
                    if len(argv) == 7:
                        as_theme = bool(argv[6])
                        if len(argv) == 8:
                            as_source = bool(argv[7])
                            if len(argv) == 9:
                                as_all = bool(argv[8])
                                if len(argv) == 10:
                                    scale = bool(argv[9])
 

anonymous

+5

<?php
// Get the first element of an array... sigh
foreach ($someArray as $key => $value) {
    $firstElement = $value;
    break;
}

// Disclaimer: the variable names were changed to protect the coder from bigger shaming
?>
 

+4

// No kidding, it's from FUCKING PRODUCTION CODE

// Retrieve
var MongoClient = require('mongodb').MongoClient;
var schools;
// Connect to the db
MongoClient.connect("mongodb://localhost:[CENSORED]/[CENSORED]", function(err, db) {
    if(!err) {
        console.log("We are connected");
        schools = db.collection('schools');

    }else
    {
        console.log(err)
    }
});

function Schools(){
    if(schools){

    }
    else
    {
        return 'test';
    }
}

module.exports = Schools;
 

0

            event.dateLabelSimple = (function (d) {
                return d >= 10 ? String(d) : ('0' + String(d))
            })(eDate.getDate())
            + '.' + romanDigits[(eDate.getMonth() + 1)];


            event.dateLabel = (function (d) {
                return d >= 10 ? String(d) : ('0' + String(d))
            })(eDate.getDate())
            + '.' + romanDigits[(eDate.getMonth() + 1)];

            if (
                eDate.getDate() == e2Date.getDate()
                &&
                eDate.getMonth() == e2Date.getMonth()
            ) {

            } else {
                if (
                    eDate.getMonth() == e2Date.getMonth()
                ) {
                    event.dateLabelSimple = (function (d) {
                        return d >= 10 ? String(d) : ('0' + String(d))
                    })(eDate.getDate())
                    + " - "
                    + (function (d) {
                        return d >= 10 ? String(d) : ('0' + String(d))
                    })(e2Date.getDate()) + ' '
                    + romanDigits[(e2Date.getMonth() + 1)];

                } else {
                    event.dateLabelSimple = (function (d) {
                        return d >= 10 ? String(d) : ('0' + String(d))
                    })(eDate.getDate())
                    + '.' + romanDigits[(eDate.getMonth() + 1)] + " - "
                    + (function (d) {
                        return d >= 10 ? String(d) : ('0' + String(d))
                    })(e2Date.getDate()) + '.'
                    + romanDigits[(e2Date.getMonth() + 1)];

                }

                event.dateLabel += '<br/><span>' + event.dateLabelSimple + '</span>';
            }


            event.hoursLabel = eDate.getHours()
            + ":" + (eDate.getMinutes() || '00')
            + " - " + e2Date.getHours() + ":" + (e2Date.getMinutes() || '00');


            return event

        });
    });
 

-1

var romanDigits = ['_', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII'];
 

+2

// Actual function from production code. The script breaks after removing it.

function p2u(path) {
    // returns undefined
}
 

+6

.absolute {
    position: absolute;
}
.clear {
    clear: both;
}
.fixed {
    position: fixed;
}
.float-left {
    float: left;
}
.float-right {
    float: right;
}
.grid {
    margin: 0 auto;
    width: 980px;
}
.relative {
    position: relative;
}
.text-left {
    text-align: left;
}
.text-center {
    text-align: center;
}
.text-right {
    text-align: right;
}
.upper {
    text-transform: uppercase;
}
 

anonymous

-2

if False and related:  # Temporary blocked
    # stuff
 

anonymous

+4

/**
 * Retrieve Attribute Group Id by Id or Name
 *
 * @param mixed $entityTypeId
 * @param mixed $setId
 * @param mixed $groupId
 * @return Mage_Eav_Model_Entity_Setup
 */
public function getAttributeGroupId($entityTypeId, $setId, $groupId)
{
    if (!is_numeric($groupId)) {
        $groupId = $this->getAttributeGroup($entityTypeId, $setId, $groupId, 'attribute_group_id');
    }

    if (!is_numeric($groupId)) {
        $groupId = $this->getDefaultAttributeGroupId($entityTypeId, $setId);
    }

    if (!is_numeric($groupId)) {
        throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Wrong attribute group ID'));
    }
    return $groupId;
}
 

anonymous

+1

var current = Math.max.apply(Math, $(this).parent().parent().parent().parent().find('input').map(function () {
    return this.name.match(/\d+/);
}).get());
var next = Math.max.apply(Math, $(this).parent().parent().parent().parent().find(".features").last().find('input').map(function () {
    var t = this.name.match(/\d+/g);
    return t[1];
}).get()) + 1;
if (!isFinite(next))
    next = 0;
 

anonymous

+14

<img src="../../../../../../../../../../../../../../../../../assets/logo.png" />
 

anonymous

+1

//Set initial focus on load
protected void Timer1_Tick(object sender, EventArgs e)
{
    Timer1.Enabled = false;
    ((ScriptManager)Page.FindControl("MasterScript")).SetFocus(txtCNPJ);
}