Skip to content

Instantly share code, notes, and snippets.

View yhoyoex's full-sized avatar
🏠
Working from home

Bayu Trisnapati yhoyoex

🏠
Working from home
  • Fifty Two.corp
  • Novara, Italy
View GitHub Profile
function preprocessImage(canvas) {
const ctx = canvas.getContext('2d');
const image = ctx.getImageData(0,0,canvas.width, canvas.height);
blurARGB(image.data, canvas, 1);
dilate(image.data, canvas);
invertColors(image.data);
thresholdFilter(image.data, 0.4);
return image;
}
@yhoyoex
yhoyoex / laravel-socket-io.md
Created August 1, 2021 19:21 — forked from brainlagid/laravel-socket-io.md
Setup Laravel with Socket.io [Ubuntu 20.04]

Server Requirement

  • Redis sudo apt install redis-server
  • Composer here
  • npm sudo apt install nodejs npm
  • laravel-echo-server npm install -g laravel-echo-server

Laravel Dependencies Requirement

  • predis
  • laravel-echo
  • socket.io-client ^2.4.0 issue
@yhoyoex
yhoyoex / index.html
Created March 10, 2019 00:04
Space Invaders Game ( 404 )
<p class="center">Space Invadors destroyed this page! Take revenge on them!
<br/> Use <span class="label label-danger">Space</span> to shoot and <span class="label label-danger">←</span>&#160;<span class="label label-danger">→</span> to move!&#160;&#160;&#160;<button class="btn btn-default btn-xs" id="restart">Restart</button></p>
<canvas id="space-invaders"/>
$transaction = Shipping::with(['termin' => function ($query) use ($date_start, $date_end){
$query->whereBetween('payment_date',[$date_start, $date_end]);
}])
->whereBetween('created_at',[$date_start, $date_end])
->get();
$termin_total = $transaction->sum(function ($transaction) {
return $transaction->termin->sum('payment');
});
$filtered = $transaction->filter(function ($transaction, $key) {
return $transaction->payment_type == 'pay_off';
});
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Model
{
use SoftDeletes;
/**