self.isOptionsVisible = ko.computed(function() {
if((self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isNameVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isBeforeAfterImagesVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isTooltipVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isLabelVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload') || (self.type() == 'info')) {
return true;
}
return false;
}, this);
self.isClassVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isStyleVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
object orientation overrated. let's check the fields in several places ...
if (isset($data['phone_id']) && !empty($data['phone_id'])) {
$userPhone = $this->getDoctrine()->getRepository('STODBBundle:Phones')->find($data['phone_id']);
if ($userPhone->getPhoneNumber() != $data['phone'] || $userPhone->getMobileProviderCode()->getId() != $data['phone_code']) {
if ($data['smsCode'] ?? false) {
if ($sessionSmsCode !== $data['smsCode']) {
$aData['smsCodeShow'] = false;
$aData['isWrongCode'] = true;
} else {
$aData['isWrongCode'] = false;
$checkCode = $data['smsCode'];
}
} else {
$aData['smsCodeShow'] = true;
$aData['isWrongCode'] = true;
}
} elseif (!$userPhone->getCodeCheck()) {
if ($data['smsCode'] ?? false) {
if ($sessionSmsCode !== $data['smsCode']) {
$aData['smsCodeShow'] = false;
$aData['isWrongCode'] = true;
} else {
$aData['isWrongCode'] = false;
$checkCode = $data['smsCode'];
}
} else {
$aData['smsCodeShow'] = true;
}
} else {
$aData['isWrongCode'] = false;
}
} else {
if ($data['smsCode'] ?? false) {
if ($sessionSmsCode !== $data['smsCode']) {
$aData['smsCodeShow'] = false;
$aData['isWrongCode'] = true;
} else {
$aData['isWrongCode'] = false;
$checkCode = $data['smsCode'];
}
} else {
$aData['smsCodeShow'] = true;
}
}
shit ... this junior
String s = "string";
String.valueOf(s).toString();
// just to make sure it's a damn string
while(!s instanceof String) {
String.valueOf(s).toString();
}
public enum DataSize {
BYTE,
DOUBLE_BYTE,
INT,
LONG;
public boolean isEqualTo(Object value) {
if(value instanceof Byte && this.equals(BYTE)) {
return true;
} else if ((value instanceof Character || value instanceof Short) && this.equals(DOUBLE_BYTE)) {
return true;
} else if ((value instanceof Integer) && this.equals(INT)) {
return true;
} else if ((value instanceof Long) && this.equals(LONG)) {
return true;
}
return false;
}
}
int w = 100;
for (nil; w!=0; nil) {
w -= 1;
//so some shit
}
this code was found in chinese contract work
// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
Never, ever define developer environment and debug as default thing! #pdk
let foo = {} // object no. 1
let bar = {} // object no. 2
foo > bar // return false
foo < bar // return false, so maybe foo equals bar?
foo == bar // oh well, return false
// but
foo >= bar // return true, 'cause !(foo < bar) == true
return value is expected, but JS is funny
if (argv[1][0]=='D'){
demo=1;
argv[1]++;
}
if (argv[1][0]=='P'){
if (sscanf(argv[1], "P%ux%ux%ux%ux%lfx%ux%u"
,&temporal_resample
,&input_w, &input_h, &rate, &input_gamma
,&output_w
,&output_h)!=7){
fprintf(stderr,"%s: Invalid argument format\n", progname);
print_usage();
exit(3);
}
ppm=1;
}else{
if (sscanf(argv[1], "%ux%ux%ux%ux%lfx%ux%u"
,&temporal_resample
,&input_w
,&input_h
,&rate
,&input_gamma
,&output_w
,&output_h)!=7){
fprintf(stderr,"%s: Invalid argument format\n", progname);
print_usage();
exit(3);
}
Found in a chroma subsampling algorithm.
foreach($bookings as $booking) {
$status = $apiController->getBookingStatus($booking);
if($status->error == 1) {
switch($status->message) {
case "FIND_PRV_KO": continue; //Wrong parameters
case "ERR_PREN_NOTFOUND": continue; //Request booking cannot be found
case "ERR_PRV_NOTFOUND": continue; //Check-in not carried out
default: continue;
};
continue;
}
//DO SOME STUFF...
}
Found this on a production website
class PythonClass {
protected boolean True = true;
protected boolean False = false;
protected Object None = null;
}
class MyClass extends PythonClass {
String do_something(Object foo) {
if (foo == False)
return "" ;
else if (foo == None)
return "!" ;
else if (foo == True)
return "Yay!" ;
}
}
Yikes
typedef NS_ENUM(NSUInteger, MyEnum1) {
PackagesNo1 = 1,
PackagesNo2 = 2,
PackagesNo4 = 4,
PackagesNo8 = 8
};
typedef NS_ENUM(NSUInteger, MyEnum2) {
LEVEL0 = 0,
LEVEL1 = 1,
LEVEL2 = 2,
LEVEL3 = 3
};
- (int)packagesNeededForLevel:(int)level {
switch (level) {
case LEVEL0:
return PackagesNo8;
case LEVEL1:
return PackagesNo4;
case LEVEL2:
return PackagesNo2;
case LEVEL3:
return PackagesNo1;
}
}
well done mr junior
/// <summary>
/// Builds the suffixs for the request sequence number
/// </summary>
/// <param name="i"></param>
/// <returns></returns>
public static string GetSequenceNumber(int i)
{
string strCount = string.Empty;
string increase = string.Empty;
int count;
strCount = i.ToString();
count = strCount.Length;
//Add 0 infront of the index to make a 4 digit number
if (count < 5)
{
for (int j = 0; j < (4 - count); j++)
{
increase = increase + "0";
}
strCount = increase + strCount;
}
return strCount;
}
def isBool(l):
if l != True or l != False:
return False
return True
latest_tag = "0.0.0"
for tag in tags:
if tag.name.startswith( 'v' ):
if tag.name.replace('v','').replace('.','') > latest_tag.replace('.',''):
latest_tag = tag.name.replace('v','')
<?php
$arr = [
["price" => 1],
["price" => 2]
];
$update = $arr;
$update[0]["price"] = 4;
$arr = $update;