Skip to content

Instantly share code, notes, and snippets.

@dypsilon
dypsilon / callback_pattern.js
Last active April 28, 2024 08:53
The callback pattern found in many node.js functions.
var invokee1 = function(err, callback) {
// cant change this function
callback();
};
var invokee2 = function(err, optional1, optional2, callback) {
// work with optional 1 or optional 2
console.log(optional1);
console.log(optional2);
// cant change this function
@dypsilon
dypsilon / reader_future.js
Created August 9, 2016 19:21
Reader + Future Monads Usage
/**
* This short program will encrypt the user password
* and insert a new record into a mock database.
*/
const Reader = require('fantasy-readers');
const Future = require('fluture');
const R = require('ramda');
const crypto = require('crypto');
// our mock database
@dypsilon
dypsilon / examples.js
Last active April 28, 2024 08:52
Lazy Continuation Monad in JavaScript
const Cont = require('./lazy-continuation');
// pointed version
const c = Cont.of(5) // initial value
.chain((x) => {
return Cont.of(x + 5); // synchronous computation
})
.chain((x) => { // async computation
return new Cont((resolve) => {
setTimeout(() => resolve(x + 15), 500);
@nafiesl
nafiesl / how_to_get_telegram_chat_id.md
Created December 20, 2023 11:49
How to get Telegram Bot Chat ID

How to get Telegram Bot Chat ID

Create a Telegram Bot and get a Bot Token

  1. Open Telegram application then search for @BotFather
  2. Click Start
  3. Click Menu -> /newbot or type /newbot and hit Send
  4. Follow the instruction until we get message like so
    Done! Congratulations on your new bot. You will find it at t.me/new_bot.
    
@skfarhat
skfarhat / VSCode Internal Commands
Created May 19, 2020 21:22
List of VSCode commands
--------------------------------------------
Version: 1.45.1
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
Date: 2020-05-14T08:33:47.663Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 18.5.0
-------------------------------------------
@subfuzion
subfuzion / curl.md
Last active April 28, 2024 08:50
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@dypsilon
dypsilon / js-performance-research.md
Created December 10, 2012 17:43
JS Performance Research

Memory Management and Performance

JavaScript engines such as Google’s V8 (Chrome, Node) are specifically designed for the fast execution of large JavaScript applications. As you develop, if you care about memory usage and performance, you should be aware of some of what’s going on in your user’s browser’s JavaScript engine behind the scenes.

Continue reading Writing Fast, Memory-Efficient JavaScript, great general overview of a Google employee

Videos

@dypsilon
dypsilon / reader.js
Last active April 28, 2024 08:50
Example usage of the reader monad.
/**
* This short program will encrypt the user password
* and insert a new record into a mock database.
*/
const Reader = require('fantasy-readers');
const R = require('ramda');
const crypto = require('crypto');
// our mock database
const database = [