Skip to content

Instantly share code, notes, and snippets.

View marufmax's full-sized avatar
🎯
Focusing

Maruf Alom marufmax

🎯
Focusing
View GitHub Profile
@marufmax
marufmax / query.php
Last active July 26, 2018 03:40
Eloquent with raw sql and eqlouent where join select
<?php
//Raw SQL
$present = DB::select(DB::raw("SELECT count(had.emp_id) as present FROM hta_emp_personal hep
INNER JOIN hta_attendance_details had ON hep.emp_id=had.emp_id
AND had.att_date='2018-07-07 00:00:00'
AND had.status='P'"));
// ORM
@marufmax
marufmax / v-cloak.md
Created July 23, 2018 09:17 — forked from adamwathan/v-cloak.md
Useful CSS utilities for Vue.js cloaking

Handy helpers for controlling visibility of elements until Vue has compiled.

Use like:

<div v-cloak>
  <h1>
    <span class="v-cloak--inline">Loading...</span> <!-- Only displayed before compiling -->
    <span class="v-cloak--hidden">{{ post.title }}</span> <!-- Hidden until compiling is finished -->
 
@marufmax
marufmax / nginx-tuning.md
Created June 26, 2018 09:45 — forked from luuminhthai/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@marufmax
marufmax / PhpUbuntuOracle.sh
Created June 26, 2018 09:45
PHP Ubuntu and Oracle
sudo ln -s /opt/oracle/instantclient_12_1/sqlplus /usr/bin/sqlplus
sudo ln -s /opt/oracle/instantclient_12_1 /opt/oracle/instantclient
sudo ln -s /opt/oracle/instantclient_12_1/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so
sudo ln -s /opt/oracle/instantclient_12_1/libocci.so.12.1 /opt/oracle/instantclient/libocci.so
sudo apt install -y php7.1-fpm php7.1-curl php7.1-gd php7.1-mcrypt php7.1-mbstring php7.1-gettext php7.1-token-stream php7.1-zip
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client/lib/:$LD_LIBRARY_PATH
@marufmax
marufmax / settings.json
Created June 2, 2018 05:24
My VScode Settings
{
"workbench.iconTheme": "vscode-icons",
"gitlens.advanced.messages": {
"suppressShowKeyBindingsNotice": true
},
"php.validate.executablePath": "C:/laragon/bin/php/php-7.1.14-Win32-VC14-x64/php.exe",
"files.autoSave": "afterDelay",
"workbench.colorTheme": "Visual Studio Light",
"editor.multiCursorModifier": "ctrlCmd",
"git.autofetch": true,
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@marufmax
marufmax / _ide_helper_custom.php
Created April 12, 2018 11:14
Laravel PHPStrom IDE Helper PHP File
<?php
namespace {
exit("This file should not be included, only analyzed by your IDE");
}
namespace Illuminate\Support {
/**
* @method Fluent first()
@marufmax
marufmax / ProductsTableSeeder.php
Created March 30, 2018 20:49
Products Table Seeder with Faker (Fake Data) - Laravel
<?php
use Illuminate\Database\Seeder;
use App\Product;
use Faker\Factory as Faker;
class ProductsTableSeeder extends Seeder
{
/**
@marufmax
marufmax / random.java
Last active March 26, 2018 11:38
Android Random Number Guessing Game
package com.example.marufalom.calculator;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Random;
@marufmax
marufmax / destroy.php
Created March 23, 2018 21:46
Laravel CRUD
public function destroy(Company $company)
{
$findCompany = Company::find( $company->i);
if ($findCompany->delete()) {
return redirect()->route('companies.index')->with('success','Company Deleted Successfully');
}
return back()->withInput()->with('error','Delectation Error');
}