This file contains hidden or 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 ClassWhoAmI { | |
#prefix = 'It is the secret' | |
suffix = 'person' | |
static additional = 'bad one' | |
constructor(parameter) { | |
this.parameter = parameter | |
} | |
getValue() { |
This file contains hidden or 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
use std::io; | |
macro_rules! parse_input { | |
($x:expr, $t:ident) => ($x.trim().parse::<$t>().unwrap()) | |
} | |
#[derive(Debug)] | |
enum Val1 { | |
Val(i32), | |
Ref(usize), |
This file contains hidden or 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
const path = require('path'); | |
const TerserPlugin = require('terser-webpack-plugin'); | |
const nodeExternals = require('webpack-node-externals'); | |
const webpack = require('webpack'); | |
const paths = require('../paths'); | |
const resolvers = require('./resolvers'); | |
const loaders = require('./loaders'); | |
const plugins = require('./plugins'); |
This file contains hidden or 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
const Maze = ` ############################ | |
# # # # # | |
# #### # #### # # #### # | |
# # # # # | |
####### ########## ########## | |
# # # # # # # # | |
# # # # #### # # #### # | |
# # # # | |
# # # #### #### #### #### | |
# # # # # # # # |
This file contains hidden or 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 {} from 'ts-jest'; | |
import * as parse from 'csv-parse'; | |
import {StreamReadCallback, StreamReadable, streamReadable} from './Readable' | |
import {CsvRow, csvStreamReadApplyCallbacks} from './Readable_Csv' | |
import { testing } from 'bs-logger'; | |
interface SpecificCSVRow { | |
first: string | |
second: string | |
} |
This file contains hidden or 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
<?php | |
$GLOBALS['plusMinus'] = [ | |
'-' => function ($a, $b) { return $a - $b; }, | |
'+' => function ($a, $b) { return $a + $b; }, | |
]; | |
$GLOBALS['multiplyDivide'] = [ | |
'*' => function ($a, $b) { return $a * $b; }, | |
'/' => function ($a, $b) { return $a / $b; }, | |
]; |
This file contains hidden or 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
export const Validator = (value, props, ...customValidators) => (validators => validators.reduce((errors, validate) => [...errors, ...validate(value, props)], []))([ | |
// Here the list of validators | |
(value, props) => typeof value !== 'string' | |
|| props.type !== 'email' | |
|| /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(value.toLowerCase()) ? [] : [{error: Errors.EMAIL}], | |
(value, props) => typeof value !== 'string' | |
|| typeof props.maxLength === 'undefined' | |
|| parseInt(props.maxLength) >= value.length ? [] : [{error: Errors.MAXLENGTH, length: parseInt(props.maxLength)}], | |
/** | |
* Other validators here |
This file contains hidden or 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
const resultCombination = cache => result => (getResult = true) => getResult ? result : cache | |
const cacheResult = ({resultCombination}) => result => n => resultCombination({...result(false), [n]: result()})(result()) | |
const memoize = ({resultCombination, cacheResult}) => cache => f => n => cache.hasOwnProperty(n) | |
? resultCombination(cache)(cache[n]) | |
: cacheResult({resultCombination})(f(cache)(n))(n) | |
const fib2 = ({resultCombination, cacheResult, memoize}) => f1Result => f => n => resultCombination(f1Result(false))(f1Result() + memoize({resultCombination, cacheResult})(f1Result(false))(f)(n - 2)()) | |
const fib = ({resultCombination, cacheResult, memoize, fib2}) => cache => n => n === 1 || n === 2 |
This file contains hidden or 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
const maxElementProperty = (element, ...properties) => Math.max( | |
0, | |
...properties.map(property => element ? element[property] : 0) | |
); | |
const realSize = (...documentElementProps) => (...bodyProps) => Math.max( | |
0, | |
maxElementProperty(document.documentElement, ...documentElementProps), | |
maxElementProperty(document.body, ...bodyProps) | |
); |