Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
<?php
if(stristr($_SERVER['HTTP_USER_AGENT'], "Mobile")){ // if mobile browser
?>
        <link rel="stylesheet" href="style-400.css" type="text/css" />
<?php
} else { // desktop browser
?>
        <link rel="stylesheet" href="style.css" type="text/css" />
<?php
}
?>
by Valeri Tandilashvili
4 years ago
0
CSS
responsive design
4
git reset --soft HEAD^
This will reset your index to HEAD^ (the previous commit) but leave your changes in the staging area.
by Luka Tatarishvili
4 years ago
0
Git
commands
0
Output the result of serialized form values: example:
FirstName=Mickey&LastName=Mouse
$( "form" ).on( "submit", function( event ) {
  event.preventDefault();
  console.log( $( this ).serialize() );
});
by Luka Tatarishvili
4 years ago
0
JavaScript
functions
0
increase buffer size
The following issue:
...upstream sent too big header while reading response header from upstream...
Is fixed by adding these lines:
fastcgi_buffers 8 16k; # increase the buffer size for PHP-FTP
fastcgi_buffer_size 32k; # increase the buffer size for PHP-FTP
fastcgi_connect_timeout 60;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
To the site's configuration file:
server {
    listen 80;
    server_name pm.use.ge;
    root /var/www/pm.use.ge/public_html;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

        include fastcgi_params;                                                                                                                                >        deny all;
    }
}
So that the final configuration file looks like this:
server {
    listen 80;
    server_name pm.use.ge;
    root /var/www/pm.use.ge/public_html;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

        fastcgi_buffers 8 16k; # increase the buffer size for PHP-FTP
        fastcgi_buffer_size 32k; # increase the buffer size for PHP-FTP
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;

        include fastcgi_params;                                                                                                                                >        deny all;
    }
}
by Valeri Tandilashvili
4 years ago
0
Linux
1
Load CSS resource only for mobile devices
<link href="css/d1.m.min.css?t=2.9" rel="stylesheet" media="screen and (max-width: 500px)" type="text/css" />
Another way is to use
handheld
on
media
attribute
<link rel="stylesheet" type="text/css" href="mobile.css" media="handheld"/>
PHP's way to load CSS file for
mobile
devices
if(stristr($_SERVER['HTTP_USER_AGENT'], "Mobile")){
    echo '<link rel="stylesheet" href="style-400.css" type="text/css" />';
}
Load CSS resource only for desktop
<link href="css/d1.min.css?t=2.9" rel="stylesheet" media="screen and (min-width: 501px)" type="text/css" />
Another way is to use
screen
on
media
attribute
<link rel="stylesheet" type="text/css" href="screen.css" media="screen"/>
Using PHP
if(!stristr($_SERVER['HTTP_USER_AGENT'], "Mobile")){
    echo '<link rel="stylesheet" href="style.css" type="text/css" />';
}
Note: Remember this always loads the
d1.m.min.css
but activates it only on screens having max width as
500px
by Valeri Tandilashvili
4 years ago
0
CSS
2
ON DUPLICATE KEY UPDATE
Updates
paramVal
field if the row exists, otherwise inserts as a new row
INSERT INTO sysData (paramName, paramVal) 
VALUES ('payprocess', 1) 

ON DUPLICATE KEY 

UPDATE paramVal = 1 WHERE paramName = 'payprocess';
by Valeri Tandilashvili
4 years ago
0
MySQL
UPDATE
1
Appends the content to the specified file if it exists (if the file does not exist, the function creates the file and writes the content)
file_put_contents($filePath, $content, FILE_APPEND);
Note: if
FILE_APPEND
parameter is not passed, the function overwrites the content.
by Valeri Tandilashvili
4 years ago
0
PHP
functions
3
Gives permission to
services_cron/asb/log
to create files and write logs
sudo chmod -R 757 /var/www/html/services_cron/asb/log
by Valeri Tandilashvili
4 years ago
0
Linux
permissions
0
Datepicker format is
MM/DD/YYYY
and Database format is:
Y-m-d
how to format your date to the correct for you db. you can use
Carbon
:
use Carbon\Carbon;

 start_date = Carbon::parse($request->start_date)->format('Y-m-d');
use carbon function in laravel view(Blade template)
  $start_date = \Carbon\Carbon::parse( $item->start_date)->format('m/d/Y');
by გიორგი ბაკაშვილი
4 years ago
1
Laravel
Date
3
set timezone to Asia/Tbilisi (+4)
Sets
timezone
using
php.ini
file
date.timezone = Asia/Tbilisi
Sets
timezone
inside php script file
ini_set('date.timezone', 'Asia/Tbilisi');
by Valeri Tandilashvili
4 years ago
0
PHP
6
Results: 1578