Skip to content

Instantly share code, notes, and snippets.

View irkreja's full-sized avatar
🎯
Focusing

Rejaul Karim irkreja

🎯
Focusing
View GitHub Profile
function ISO8601_week_no(dt)
{
var tdt = new Date(dt.valueOf());
var dayn = (dt.getDay() + 6) % 7;
tdt.setDate(tdt.getDate() - dayn + 3);
var firstThursday = tdt.valueOf();
tdt.setMonth(0, 1);
if (tdt.getDay() !== 4)
{
tdt.setMonth(0, 1 + ((4 - tdt.getDay()) + 7) % 7);
@irkreja
irkreja / cloudSettings
Created March 4, 2020 04:29
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-03-04T04:29:28.868Z","extensionVersion":"v3.4.3"}
@irkreja
irkreja / installing-node-with-nvm.md
Created March 2, 2020 11:21 — forked from d2s/installing-node-with-nvm.md
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.
@irkreja
irkreja / CoordinatesDistance.js
Created January 27, 2020 09:09
Distance Between Coordinates
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::: :::
//::: This routine calculates the distance between two points (given the :::
//::: latitude/longitude of those points). It is being used to calculate :::
//::: the distance between two locations using GeoDataSource (TM) prodducts :::
//::: :::
//::: Definitions: :::
//::: South latitudes are negative, east longitudes are positive :::
//::: :::
//::: Passed to function: :::
@irkreja
irkreja / collections.js
Last active December 3, 2019 18:35
collections.json
[
{
"_id" : ObjectId("5de6a660a5f6a42060d532c5"),
"name": "IX",
"subjects": [
{
"_id" : ObjectId("5de6a660a5f6a42060d532c6"),
"name": "Physics",
"classId": ObjectId("5de6a660a5f6a42060d532c5"),
"chapters": [
<?php
namespace App\Helpers;
class Helper {
public static function bn_slug($string = null, $separator = "-") {
if (is_null($string)) {
return "";
}
// Remove spaces from the beginning and from the end of the string
@irkreja
irkreja / English To Bengali Number Converter
Created February 3, 2019 07:05
English To Bangla Number Converter for Laravel Helper Function
<?php
/*
"autoload": {
"files": [
"app/helpers.php"
]
},
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
# Disable Directory listing
Options -Indexes
# block files which needs to be hidden, specify .example extension of the file
@irkreja
irkreja / composer.json
Created November 25, 2018 04:28
autoload integration in composer.json for RAW PHP
{
"autoload": {
"classmap": [
"./"
],
"files": ["core/helpers.php"]
}
}
@irkreja
irkreja / Save and Optimize Image
Created November 10, 2018 19:39
Save and Optimize Image in PHP
<?php
// include composer autoload
require 'vendor/autoload.php';
// import the Intervention Image Manager Class
use Intervention\Image\ImageManager;
if (!function_exists('optimizeImage')) {
/**
* Save and Optimize Image