This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fewWords($str, $limit) { | |
return rtrim(implode(' ', array_slice(explode(' ', $str), 0, $limit)), ',-'); | |
} | |
// Example: | |
$str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function matrix($x = 3, $y = 3) { | |
$_matrix = []; | |
for($_x = 0; $_x < $x; $_x++) { | |
for($_y = 0; $_y < $y; $_y++) { | |
$_matrix[$_x][$_y] = mt_rand(1,5); | |
} | |
} | |
return $_matrix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
$count = 1; | |
if(isset($_SESSION['counter'])) { | |
$count = intval($_SESSION['counter']); | |
$_SESSION['counter']++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- юзеры | |
CREATE TABLE `users` ( | |
`id` INT(11) NOT NULL AUTO_INCREMENT, | |
`firstname` VARCHAR(32) NULL DEFAULT 'No_name', | |
PRIMARY KEY (`id`) | |
) | |
ENGINE=InnoDB | |
; | |
-- хобби |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Входящие данные | |
$article = 'hp'; // артикул товара | |
$sum = 3563; //Сумма (для теста тут принтер hp + 4 катриджа: hpb*3 + hpr*1) | |
// принтеры | |
$printersPrice = [ | |
'canon' => 1000, | |
'hp' => 2000, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from MYTABLE where id in ( | |
select id from ( | |
select id, count(*) 'c' from MYTABLE where 1 group by MYFIELD having count(`c`) > 1 | |
) as `items` | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\models; | |
use Yii; | |
use yii\base\Model; | |
use yii\data\ActiveDataProvider; | |
use common\models\User; | |
use common\models\Balance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function backSide($lat, $lon) { | |
$lat *= -1; | |
$lon = $lon < 0 ? $lon + 180 : $lon - 180; | |
return [$lat, $lon]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
//CSS | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stopping spam is a constant fight and due to this, your account has restrictions specifically on port 25. However, you are be able to use mail services using ports 587, 993, 995 and 465. You will need to open these ports in your firewall. Here is our guide to common iptables commands: | |
https://www.digitalocean.com/community/tutorials/iptables-essentials-common-firewall-rules-and-commands#service-mail | |
We realize this is inconvenient, but many customers in your position move their mailing activities to a third party service such as SendGrid or similar which processes such mail separately from their droplet. I'm sorry for the frustration but we're not able to lift this port restriction at this time. | |
In terms of a workaround, here are a few alternatives: | |
1. Utilize port 587 for SMTP relay via another mail provider, for example G Suite/Gmail, Mailgun, etc. We have a guide on doing so using Postfix here: |
OlderNewer