Skip to content

Instantly share code, notes, and snippets.

View agoalofalife's full-sized avatar
😉
Do what you can, with what you have, where you are

Ilya Chubarov agoalofalife

😉
Do what you can, with what you have, where you are
View GitHub Profile
@agoalofalife
agoalofalife / testing mail in droplet with laravel
Last active January 16, 2019 09:56 — forked from emmanuelbarturen/testing mail in droplet with laravel
send email from artisan with tinker of laravel
# SSH into droplet
# go to project
$ php artisan tinker
$ Mail::send('errors.401', [], function ($message) { $message->to('emmanuelbarturen@gmail.com')->subject('this works!'); });
Mail::raw('test', function ($message) {$message->subject('Тестовая тема');$message->from('test@test.com');$message->to('agoalofalife@gmail.com');});
# check your mailbox
// мощь js как функционального языка
// паттерн pipline в действие
// всего 5 строк кода
const compose = (...fns) =>
(arg) =>
fns.reduce(
(composed, f) => f(composed),
arg )
```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;
})
@agoalofalife
agoalofalife / live_template_bash_command.sh
Last active October 27, 2017 19:48
List commands bash, which help me in work and studies
// 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 root@00.000.000.00 "mysqldump -u username -p basename | gzip > ./`date '+%m-%y-%d-%H:%M:%S'`.basename.sql.gz"
// with ignore table
ssh root@00.000.000.00 "mysqldump -u username -p basename --ignore-table=database.table1" | gzip > ./`date '+%m-%y-%d-%H:%M:%S'`.basename.sql.gz
@agoalofalife
agoalofalife / .conf
Last active July 26, 2017 13:01
flarum ngnix setting
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; }
version: '2'
services:
nginx:
image: nginx:latest
ports:
- "8010:80"
- "442:443"
volumes:
- ./hosts:/etc/nginx/conf.d
- ./www:/var/www
<?php
use League\Pipeline\Pipeline;
interface Registrator{}
interface Notificator{}
class Order implements Registrator,Notificator
{
protected $order;
<?php
use League\Pipeline\Pipeline;
class NumberHandler
{
public function __invoke($value)
{
if (gettype($value) == 'float')
{
@agoalofalife
agoalofalife / pipleine-laravel.php
Last active July 6, 2017 08:55
An example of processing depending on values
<?php
interface Handler
{
public function handle($value, Closure $next);
}
// handler if the value
class NumberHandler implements Handler
{
@agoalofalife
agoalofalife / carry.js
Last active July 6, 2017 07:15
Способ применения каррирования в js
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)