/// <summary>
/// Method that checks if an object is not null
/// </summary>
/// <param name="obj">extend type of <see cref="Object"/></param>
/// <returns>true if object is not null</returns>
public static bool NotNull(this Object obj)
{
return obj != null;
}
[TestMethod]
public void Test_Something()
{
// test
var result = DoSomething();
// assert
Assert.IsTrue(result.NotNull());
}
const handleBoolean = value => {
switch (value) {
case "true":
return true;
case true:
return "true";
case "false":
return false;
case false:
return "false"
default:
return null;
}
}
$_POST = $this->db->mres($_POST);
$_SESSION['post'] = $_POST;
$sql = "SELECT id, documento, nombre1, nombre2, apellido1, apellido2 "
. "FROM usuarios "
. "WHERE " .
"REPLACE(" .
"REPLACE(" .
"REPLACE(" .
"REPLACE(telefono,' ','')," .
"'(','')," .
"')','')," .
"'-','') LIKE '%{$searchTel}'";
string date = user.RegistrationDate.ToShortDateString().ToString();
int minimum(int a, int b, int c){
int mini =a*b*c;
int iterator=0;
int test[3];
test[0]=a;
test[1]=b;
test[2]=c;
for (iterator=0;iterator<3;iterator++){
if (test[iterator]<mini){
mini=test[iterator];
}
}
return mini;
}
I hope that your 3 numbers aren't larger than 1290!
in_array($this->market, ["ru"])
There is an old mysterious legend, which says that those conditions are lightening fast which are using in_array($source, ["target"]) instead of just "==". Is says always that probably you never do code refactoring, and keep all shit alive
function uploadimg(file) {
var ext = file.value.split('.').pop().toLowerCase();
var size = document.getElementById("uploadpic").files.item(0).size;
if (size > 3145728) {
$.messager.alert({
title: "Error",
msg: " image to large",
icon: "error"
});
return true;
}
return false;
}
var reader = new FileReader();
$("#uploadpic").change(function() {
var pdfcheck = this;
var ext = pdfcheck.value.split('.').pop().toLowerCase();
if (!($.inArray(ext, ['pdf']) == -1)) {
console.log('upload pdf start');
if (uploadPdf(pdfcheck)) {
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
$("#uploadpic").prop("file", "");
$("#uploadpic").val("");
}
} else {
if (uploadimg(pdfcheck)) {//dude, I think the image you upload to check is your dick, only small enough you would rather keep going producing shitcode.
return false;
}
var upload_file = $("#uploadpic")[0].files[0];
if (upload_file != null) {
var chimgarr = ["image/png", "image/PNG", "image/jpg", "image/JPG", "image/jpeg", "image/JPEG", "image/gif", "image/GIF", "image/bmp", "image/BMP"];
if (chimgarr.indexOf(upload_file.type) != "-1") {
reader.readAsDataURL(upload_file);
reader.onload = function(e) {
$("#preview_img").attr("src", e.target.result);
$("#preview_img2").attr("src", e.target.result);
$("#pdf-contents").hide();
$("#pdf_name").val("");
$("#btn_pdf_view").hide();
$("#pic_name").val("");
}
} else {
$.messager.alert("Image format does not match");
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
$("#uploadpic").prop("file", "");
$("#uploadpic").val("");
}
} else {
$("#preview_img").attr("src", "");
$("#preview_img2").attr("src", "");
}
}
});
The moment an important image ready to be uploaded It's really important that should be checked again and again.
from itertools import combinations as comb
from functools import reduce
def all_arrangements(k):
m=k*(k+1)/2
m_bits_on=set([tuple(reduce(lambda x,y:x[:y]+[1]+x[y+1:],c,[0]*(2*m+1))) for c in comb(range(2*m+1),m)])
return set([tuple(sorted(filter(lambda i:i>0,reduce(lambda x,y: x+[y] if y==0 else x[:-1]+[x[-1]+1,],p,[0])))) for p in m_bits_on])
Returns all arrangements in the Bulgarian solitaire game with k piles https://en.wikipedia.org/wiki/Bulgarian_solitaire
i++;
i++;
i++;
i++;
Console.WriteLine(i);
He doesn't know what is " i+=4 " :||||
.stepper a{
}
.stepper>div>div>div>div>a{
color: transparent !important;
}
stepper>div>div>div>div>span{
color: transparent !important;
}
.stepper>div>div>div:nth-child(1)>div>a:after, .stepper>div>div>div:nth-child(1)>div>span:after{
color: rgb(52, 58, 64);
content: '4' !important;
margin-left: -10px;
}
.stepper>div>div>div:nth-child(2)>div>a:after{
color: rgb(52, 58, 64);
content: '3' !important;
margin-left: -10px;
}
.stepper>div>div>div:nth-child(3)>div>a:after{
color: rgb(52, 58, 64);
content: '2' !important;
margin-left: -10px;
}
.stepper>div>div>div:nth-child(4)>div>a:after{
color: rgb(52, 58, 64);
content: '1' !important;
margin-left: -10px;
}
.stepper>div>div>div:nth-child(4)>div>span:after{
color: rgb(52, 58, 64);
background-color: rgb(108, 117, 125);
content: '1' !important;
margin-left: -10px;
}
.stepper>div>div>div:nth-child(3)>div>span:after{
color: rgb(52, 58, 64);
background-color: rgb(108, 117, 125);
content: '2' !important;
margin-left: -10px;
}
.stepper>div>div>div:nth-child(2)>div>span:after{
color: rgb(52, 58, 64);
background-color: rgb(108, 117, 125);
content: '3' !important;
margin-left: -10px;
}
.stepper>div>div>div:nth-child(1)>div>span:after{
color: rgb(52, 58, 64);
background-color: rgb(108, 117, 125);
content: '4' !important;
margin-left: -10px;
}
$command = 'curl -X GET -H "application/json" -H "X-Api-Key: '.$key.'" https://some-api.com/resource';
exec($command, $output);
$array = json_decode($output[0], true);
Using curl in PHP is boring. Let execute a command for
let True = true
let False = false
使用Python的 True 和 False 在javascript
.black {
color: #000;
}
.not-black {
color: #999;
}
[HttpPost]
[Route("validaPrepacks")]
public IHttpActionResult ValidaPrepacks(ValidaPrepackVO validacion)
{
try
{
return Ok();
}
catch (Exception e)
{
return Ok(e.Message);
}
}
A code that "validate" a pack in the backend
class {
public State state;
//enums cant take double values...
public struct State
{
public const float IDLE = 0f;
public const float WALKING = 0.5f;
public const float RUNNING = 1f;
}
protected void Stop()
{
SetSpeed(State.IDLE);
}
protected void SetSpeed(float f)
{
agent.speed = f;
if (agent.speed > 1f && agent.speed < 5f)
{
f = State.WALKING;
agent.Resume();
}
else if (agent.speed > 5f)
{
f = State.RUNNING;
agent.Resume();
}
else
{
f = State.IDLE;
agent.Stop();
}
}
}
Who needs static float
when you can have a constant in a nested struct, as a bonus State state
has 0 references in the project