Skip to content

Instantly share code, notes, and snippets.

View dypsilon's full-sized avatar

Tim Navrotskyy dypsilon

View GitHub Profile
@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);
@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 = [
@dypsilon
dypsilon / cro.md
Created November 4, 2014 15:02
CRO

Conversion Rate Optimization (CRO)

In internet marketing, conversion optimization, or conversion rate optimization (CRO) is the method of creating an experience for a website or landing page visitor with the goal of increasing the percentage of visitors that convert into customers. It is also commonly referred to as CRO.

@dypsilon
dypsilon / .eslintrc.json
Created May 30, 2023 21:29
TypeScript ESLint Prettier Setup
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",