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
# SSH into droplet | |
# go to project | |
$ php artisan tinker | |
$ Mail::send('errors.401', [], function ($message) { $message->to('[email protected]')->subject('this works!'); }); | |
Mail::raw('test', function ($message) {$message->subject('Тестовая тема');$message->from('[email protected]');$message->to('[email protected]');}); | |
# check your mailbox |
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
// мощь js как функционального языка | |
// паттерн pipline в действие | |
// всего 5 строк кода | |
const compose = (...fns) => | |
(arg) => | |
fns.reduce( | |
(composed, f) => f(composed), | |
arg ) |
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
```js | |
let basePriceProduct = new basis.Token(0); | |
// price up for some thing | |
let priceUp = basePriceProduct.as(function(basePrice) { | |
var priceUp = basePrice/100 * 10; | |
return basePrice+priceUp; | |
}) |
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
// dump mysql with date and gzip master! | |
mysqldump -u root -p databasename | gzip > `date '+%m-%y-%d %H:%M:%S'`.databasename.sql.gz | |
// dump mysql with date and gzip master from remote server | |
ssh [email protected] "mysqldump -u username -p basename | gzip > ./`date '+%m-%y-%d-%H:%M:%S'`.basename.sql.gz" | |
// with ignore table | |
ssh [email protected] "mysqldump -u username -p basename --ignore-table=database.table1" | gzip > ./`date '+%m-%y-%d-%H:%M:%S'`.basename.sql.gz |
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
server { | |
index index.php; | |
server_name flarum.dev; | |
error_log /var/log/nginx/error.log; | |
access_log /var/log/nginx/access.log; | |
root /var/www/flarum.dev; | |
location / { try_files $uri $uri/ /index.php?$query_string; } | |
location /api { try_files $uri $uri/ /api.php?$query_string; } | |
location /admin { try_files $uri $uri/ /admin.php?$query_string; } |
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
version: '2' | |
services: | |
nginx: | |
image: nginx:latest | |
ports: | |
- "8010:80" | |
- "442:443" | |
volumes: | |
- ./hosts:/etc/nginx/conf.d | |
- ./www:/var/www |
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 | |
use League\Pipeline\Pipeline; | |
interface Registrator{} | |
interface Notificator{} | |
class Order implements Registrator,Notificator | |
{ | |
protected $order; |
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 | |
use League\Pipeline\Pipeline; | |
class NumberHandler | |
{ | |
public function __invoke($value) | |
{ | |
if (gettype($value) == 'float') | |
{ |
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 | |
interface Handler | |
{ | |
public function handle($value, Closure $next); | |
} | |
// handler if the value | |
class NumberHandler implements Handler | |
{ |
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
Function.prototype.partial = function(){ | |
var fn = this, args = Array.prototype.slice.call(arguments) | |
return function(){ | |
var arg = 0 | |
for (var i = 0; i < args.length && arg < arguments.length; i++) { | |
if(args[i] === undefined) { | |
args[i] = arguments[arg++] | |
return fn.apply(this, args) |
NewerOlder