Skip to content

Instantly share code, notes, and snippets.

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

Istiyak Amin Santo istiyakamin

🏠
Working from home
View GitHub Profile
package main
import (
"fmt"
"math"
)
type GeomatryFormula interface {
area() float64
}
@istiyakamin
istiyakamin / lamp-server-install.sh
Last active October 30, 2019 13:05
Simple run this file automatically install LAMP server within 1 minute
#!/bin/bash
# Update Package
sudo apt update
# Upgrade Package
sudo apt upgrade
# Install Apache2, MySQL, PHP
sudo apt install apache2
@istiyakamin
istiyakamin / File-read.js
Created July 1, 2019 15:02
File Data Read using Javascript (Client Side)
<html>
<head>
<meta http-equiv='Content-type' content='text/html;charset=UTF-8' >
<script>
function startRead()
{
// obtain input element through DOM
var file = document.getElementById('file').files[0];
if(file)
<?php
header('Content-Type: application/json');
$method = $_SERVER['REQUEST_METHOD'];
//GET Request
switch ($method) {
case 'GET': // read data
@istiyakamin
istiyakamin / numberToWord.js
Created October 31, 2018 09:30
Number to Word(Money) converter
function number2text(value) {
var fraction = Math.round(frac(value)*100);
var f_text = "";
if(fraction > 0) {
f_text = "AND "+convert_number(fraction)+" POISA";
}
return convert_number(value)+" TAKA "+f_text+" ONLY";
}
@istiyakamin
istiyakamin / gist:af2121f012b3730bdd92c959f2505c64
Created August 11, 2018 16:51
Laravel isActive login Credentials
/**
* Get the needed authorization credentials from the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function credentials(\Illuminate\Http\Request $request)
{
//return $request->only($this->username(), 'password');
return ['email' => $request->{$this->username()}, 'password' => $request->password, 'status' => 1];
@istiyakamin
istiyakamin / Detect User Online Status in Laravel
Last active July 21, 2018 12:47
Detect User Online Status in Laravel
// First of all you need to create a Middleware
php artisan make:middleware LastUserActivity
// Add this Middleware in Kernel
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
function roman_to_Int(str1) {
if(str1 == null) return -1;
var num = char_to_int(str1.charAt(0));
var pre, curr;
for(var i = 1; i < str1.length; i++){
curr = char_to_int(str1.charAt(i));
pre = char_to_int(str1.charAt(i-1));
if(curr <= pre){
num += curr;