This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { interval, Observable } from 'rxjs'; | |
import { map, withLatestFrom } from 'rxjs/operators'; | |
function addOne(n: number): number { | |
return (n + 1); | |
} | |
function toOdd(n: number): number { | |
return ((n * 2) + 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUDO_NVM__ROOT_DIR="/usr/bin" | |
function forbidsudonvm() { | |
if [[ "$#" -eq 0 ]] | |
then | |
forbidsudonvm node | |
forbidsudonvm npm | |
forbidsudonvm npx | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRock(M, N) { | |
const number = 2 ** Math.floor(Math.log2(M)); | |
const distance = Math.floor(1 + (N / number)); | |
const shift = (1 / 2); | |
const index = M % number; | |
return (distance * (shift + index)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "", | |
"version": "", | |
"description": "", | |
"keywords": "", | |
"license": "", | |
"author": "", | |
"contibutors": "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Symb(description = null, data = null) { | |
function state(data = null) { | |
state.data = data; | |
return state; | |
} | |
state.toString = () => { | |
return `Symb(${state.description}, ${state.data})`; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function to_roman(num) | |
{ | |
const roman_digits = ['I', 'V', 'X', 'L', 'C', 'D', 'M']; | |
const count = Math.trunc(roman_digits.length / 2); | |
let den = Math.pow(10, count); | |
let dig = Math.trunc(num / den); | |
let roman_number = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExtendProxy { | |
constructor() { | |
const target = { /* ... */ }; | |
const handler = { /* ... */ }; | |
const proxy = new Proxy(target, handler); | |
Reflect.setPrototypeOf(proxy, ExtendProxy.prototype); | |
return proxy; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function A(b, c) { | |
let callCounter = 0; | |
let cacheCounter = 0; | |
let cache = []; | |
const ackermann = (m, n) => { | |
callCounter += 1; | |
if (!cache[m]) { | |
cache[m] = []; | |
} |