Skip to content

Instantly share code, notes, and snippets.

View developersharif's full-sized avatar
:octocat:
Focusing

Sharif developersharif

:octocat:
Focusing
View GitHub Profile
@developersharif
developersharif / LCG.js
Created May 2, 2023 10:55
The code provides a simple implementation of the Linear Congruential Generator (LCG) algorithm in JavaScript. LCG is a type of pseudo-random number generator that produces a sequence of numbers that appear to be random but are actually determined by a mathematical formula. The algorithm takes a seed value as input and generates a sequence of pse…
class LCG {
constructor() {
this.seed = Date.now();
this.a = 1664525;
this.c = 1013904223;
this.m = Math.pow(2, 32);
}
nextInt() {
this.seed = (this.a * this.seed + this.c) % this.m;
@developersharif
developersharif / deno.js
Created April 30, 2023 11:14
Hello world in Deno
import { log } from "https://cdn.skypack.dev/fp-ts/Console";
log("hello world!")();
@developersharif
developersharif / server.(improved).js
Last active April 19, 2023 08:25
PHP Vs Nodejs Benchmark
const mysql = require('mysql2/promise');
const http = require('http');
const pool = mysql.createPool({
host: 'localhost',
user: 'root',
password: '',
database: 'nobarun',
waitForConnections: true,
connectionLimit: 10,
@developersharif
developersharif / PHP-Swoole-http-server.php
Created April 19, 2023 05:41
PHP-Swoole-http-server
<?php
// Create a new HTTP server on port 8080
$server = new Swoole\Http\Server("0.0.0.0", 4000);
// Define a route handler for the root path
$server->on("request", function ($request, $response) {
// Get the request path
$path = $request->server['request_uri'];
@developersharif
developersharif / Monaco-Editor.html
Created March 5, 2023 11:20
Monaco Editor Example with multiple languages
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Monaco Editor</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/min/vs/editor/editor.main.css">
</head>
<body>