Results: 1580
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)

<?php
function beautiful($o) {
return substr_count($o, 010);
}

print_r (beautiful(0100100100100100111010101001011010); //output- 6
by Gvanca Gharibashvili
2 years ago
0
PHP
Object Oriented PHP Tutorial
0
/*SRT_PAD function returns the string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string is not supplied, the string is padded with spaces, otherwise it is padded with characters from pad_string up to the limit.*/ <?php // Multiplication table for ($h=1; $h<=10; $h++){ for ($v=1; $v<=10; $v++){ if ($v==1){ echo str_pad($v*$h, 2, " ", STR_PAD_LEFT);} else{ echo str_pad($v*$h, 4, " ", STR_PAD_LEFT); } } echo "\n"; } ?>
by Anna Tukvadze
2 years ago
0
PHP
Multiplication table
0

<?php
function number($x) {

if ($x % 2) {
               echo " even";
        } else {
              echo "odd";
    }
      echo (number(100)); \\result- even
      echo (number(23));\\ result- odd
}


by Gvanca Gharibashvili
2 years ago
0
PHP
Object Oriented PHP Tutorial
0

<?php
 
function code($code) {

$x=strlen($code);

if ($x == 4) {
              echo "true";
        } else if ($x==6) {
              echo "true";
        } else {
              echo "false"
     }
}

echo (code(1234)); \\result-true
echo (code(a4b56r)); \\result-true
echo (code(t674rhedbt8w39); \\result-false
by Gvanca Gharibashvili
2 years ago
0
PHP
Object Oriented PHP Tutorial
0

<?php 
function numbers ($x) {
       if ($x > 0) {
                echo "number is positive";
       } else if ($x == 0) {
                echo "number is zero";
        } else {
                echo " number is negative";
         }
}
echo numbers(256); \\ result-- number is positive
echo numbers(0); \\ result-- number is zero
echo numbers(-123); result-- number is negative
by Gvanca Gharibashvili
2 years ago
0
PHP
Object Oriented PHP Tutorial
0

<?php 
function func($x, $y) {
	
echo " until change: $x, $y"."\n";

$num=$x;
$x=$y;
$y=$num;

echo "result: $x, $y";
}
func(2,1);

\\ result-- until change: 2----1, result:1-----2
by Gvanca Gharibashvili
2 years ago
0
PHP
Object Oriented PHP Tutorial
0

$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~                              # (1)
[ edit files as necessary ]                    # (2)
$ git add .                                    # (3)
$ git commit -c ORIG_HEAD                      # (4)

The main command which is removing last commit and back ups files in staging area is
$ git reset HEAD~ 
by Luka Tatarishvili
2 years ago
0
Git
0
Postman Snippets
Get variables
pm.environment.get("variable_key");
pm.globals.get("variable_key");
pm.variables.get("variable_key");
pm.collectionVariables.get("variable_key");
Set variables
pm.environment.set("variable_key", "variable_value");
pm.globals.set("variable_key", "variable_value");
pm.collectionVariables.set("variable_key", "variable_value");
Unset variables
pm.environment.unset("variable_key");
pm.globals.unset("variable_key");
pm.collectionVariables.unset("variable_key");
Send a request
pm.sendRequest("https://postman-echo.com/get", function (err, response) {
    console.log(response.json());
});
Status code: Code is 200
pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});
Response body: Contains string
pm.test("Body matches string", function () {
    pm.expect(pm.response.text()).to.include("string_you_want_to_search");
});
Response body: JSON value check
pm.test("Your test name", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData.value).to.eql(100);
});
Response body: is equal to a string
pm.test("Body is correct", function () {
    pm.response.to.have.body("response_body_string");
});
Response headers: Content-Type header check
pm.test("Content-Type is present", function () {
    pm.response.to.have.header("Content-Type");
});
Response time is less than 200ms
pm.test("Response time is less than 200ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(200);
});
Status code: Successful POST request
pm.test("Successful POST request", function () {
    pm.expect(pm.response.code).to.be.oneOf([201, 202]);
});
Status code: Code name has string
pm.test("Status code name has string", function () {
    pm.response.to.have.status("Created");
});
Response body: Convert XML body to a JSON Object
var jsonObject = xml2Json(responseBody);
Use Tiny Validator for JSON data
var schema = {
    "items": {
        "type": "boolean"
    }
};
var data1 = [true, false];
var data2 = [true, 123];
pm.test('Schema is valid', function () {
    pm.expect(tv4.validate(data1, schema)).to.be.true;
    pm.expect(tv4.validate(data2, schema)).to.be.true;
});
by Valeri Tandilashvili
2 years ago
0
Postman
0
Get the first and last days of the current month
Gets the first and last days of the current month and passes it to the request using
start_date
and
end_date
variables. The following script should be located in
Pre-request Script
let date = new Date();
let year = date.getFullYear()
let month = ("0" + (date.getMonth() + 1)).slice(-2)
let start_date = year+'-'+month+'-01';
let days = new Date(year, month, 0).getDate()
let end_date = year+'-'+month+'-'+days;

pm.collectionVariables.set("start_date", start_date);
pm.collectionVariables.set("end_date", end_date);
Get URL of the request
https://httpbin.org/get?start_date={{start_date}}&end_date={{end_date}}
by Valeri Tandilashvili
2 years ago
0
Postman
0
fresh and seed single table and seeder without loosing data in another tables in laravel
1) add this code
 DB::statement('SET FOREIGN_KEY_CHECKS=0;');
 DB::table('rcsa_timeline_statuses')->truncate();
 DB::statement('SET FOREIGN_KEY_CHECKS=1;');
2) Seed database
php artisan db:seed --class=RcsaProgressSeederĀ 
by Luka Tatarishvili
2 years ago
0
Laravel
MySQL
0
Results: 1580