Skip to content

Instantly share code, notes, and snippets.

View MinSomai's full-sized avatar
🇳🇵
from the land of Mountains, Nepal. Namaste!

Min Somai MinSomai

🇳🇵
from the land of Mountains, Nepal. Namaste!
View GitHub Profile
const _ = require('lodash');

// RequestedDateTimeHelper is a helper related to requested times.
// Requested dates can be either datetime or time (military).
class RequestedDateTimeHelper {
    /**
     * isDateTimeDifferent method returns true if datetime/time is different
     *
     * Time can change from:
{
"lastIndex": 110016362472800256,
"clientSegment": [
0,
128
],
"updates": [
{
"index": 110015715536535552,
"timestamp": "2023-03-13T11:23:16.887Z",
let update8 = {
lastIndex: 110016159375425536,
clientSegment: [0, 128],
updates: [
{
index: 110015715536535552,
timestamp: '2023-03-13T11:23:16.887Z',
before: null,
after: {
voyageId: 'b0571ec1-ff7c-4b67-b00d-0121bd8dc372',
let updates3 = {
lastIndex: 110014217503309824,
clientSegment: [0, 128],
updates: [
{
index: 110014180472848384,
timestamp: '2023-03-13T04:52:53.677Z',
before: {
voyageId: '5a21e768-9670-48e6-8522-551e4eef7f00',
declarant: {
[
{
"@class": "com.portbase.hinterland.api.common.Terminal",
"shortName": "NONPCS_ROTTERDAM",
"ean": null,
"bicsCode": "00RHB",
"quayName": "Rotterdams Haven Bedrijf",
"smdgCode": null,
"location": {
"name": "Rotterdam",
let updates2 = {
lastIndex: 110014179357687808,
clientSegment: [0, 128],
updates: [
{
index: 110013966679998464,
timestamp: '2023-03-13T03:58:31.456Z',
before: {
voyageId: 'b4ee3a61-ede9-43bd-aef8-0eb65e19cfaf',
declarant: {
@MinSomai
MinSomai / server.js
Created September 19, 2022 03:18 — forked from dlukes/server.js
Pattern for using Promise-based background jobs in Node + Express.
/* A quick reminder on how to use Promises with Node and Express in order to run potentially
* time-consuming jobs asynchronously (assuming the jobs are able to run in the background thanks to
* libuv and actually return Promises).
*
* Start the server, navigate to /startjob, then refresh a few times, the job should be in progress.
* You can navigate elsewhere in the "app" in other browser tabs in the meanwhile (/). After about
* 20s, you should get a result by refreshing the tab where you originally submitted the job.
*
* I hope this pattern will be useful e.g. for processing images with the `sharp` library (see
* <http://sharp.dimens.io>).
@MinSomai
MinSomai / amazon.md
Created September 12, 2022 15:54 — forked from terabyte/amazon.md
Amazon's Build System

Prologue

I wrote this answer on stackexchange, here: https://stackoverflow.com/posts/12597919/

It was wrongly deleted for containing "proprietary information" years later. I think that's bullshit so I am posting it here. Come at me.

The Question

Amazon is a SOA system with 100s of services (or so says Amazon Chief Technology Officer Werner Vogels). How do they handle build and release?

@MinSomai
MinSomai / SerializeContent.js
Last active June 26, 2022 13:32
Slatejs to Vue 3 html serializer - custom render function for SlateJS to vue 3 Vnodes
// How to use?
// Save this file as SerializeContent.js
//
// import SerializeContent from "../SerializeContent";
// <template>
// <SerializeContent :content="content" />
// </template>
import escapeHTML from "escape-html";
import { Text } from "slate";
@MinSomai
MinSomai / Readme.md
Created May 27, 2022 17:25
Official Wordpress Docker in japanese language (or other).
  1. Get Wordpress Docker
  2. Download Japanese Wordpress
  3. Copy the "wp-content/languages" directory from japanese wordpress.
  4. Paste it in the Wordpress Docker "wp-content"

Viola!