Skip to content

Instantly share code, notes, and snippets.

@imadx
imadx / sublime-text-configuration.md
Created July 8, 2024 15:17
This gist details how to configure Sublime Merge to open files in VS Code and Webstorm. It provides the Editor Path and Editor Argument Format for each text editor. This allows you to seamlessly switch between Sublime Merge and your preferred editor to work on specific files.

Opening a file with the text editors for Sublime Merge

VSCode

Settings > Editor > Editor Path

code
@imadx
imadx / LiveUserCount.js
Last active May 17, 2020 18:39
Live User Count with NodeJS and Socket.io
const WHITELISTED_ORIGINS = ["https://adeka.lk"];
const PORT = process.env.PORT || 3000;
const io = require("socket.io")(PORT);
let userCount = 0;
// Checks if the socket connection is from a whitelisted origin
const isNotWhitelisted = (origin) => {
return WHITELISTED_ORIGINS.indexOf(origin) === -1;
@imadx
imadx / Consequences of bad design choices
Last active October 2, 2017 06:42
Design choice makes a huge impact on the outcome. We must choose wisely.
const events = require('events');
const eventEmitter = new events.EventEmitter();
const FREQUENCY = process.env.FREQUENCY_BELOVED || 1000;
const WORK_DURATION = process.env.VARIANCE_WORK_DURATION || 10000;
const PATIENCE = process.env.LIMIT_PATIENCE || 1000;
let alive = null;
let beloved = null;
.d8888. d88888b d888888b
88' YP 88' `~~88~~'
`8bo. 88ooooo 88
`Y8b. 88~~~~~ 88
db 8D 88. 88
`8888Y' Y88888P YP
set HTTP_PROXY=http://cachex.pdn.ac.lk:3128
set HTTPS_PROXY=http://cachex.pdn.ac.lk:3128
<style type="text/css">
body{
font-weight: 100;
}
div.displayContainer{
background: #eee;
padding: 10px;
box-shadow: inset 0 0 3px -2px #000, inset 0 6px 6px -6px #000;
}
div.displayContainer h2{