function randn_bm() {
let u = 0, v = 0;
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
while(v === 0) v = Math.random();
let num = Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
num = num / 10.0 + 0.5; // Translate to 0 -> 1
if (num > 1 || num < 0) return randn_bm() // resample between 0 and 1
return num
}
function randomIntegerInRange(min, max) {
return Math.floor(randn_bm() * (max - min + 1)) + min;
}
console.log(randomIntegerInRange(1, 6));
interface IDefaultItemsLayout<T> {
items: T[];
}
export default function DefaultItemsLayout<T>(
props: React.PropsWithChildren<IDefaultItemsLayout<T>>
) { ... }
main.js
или main.ts
импортируете его:import '@fontsource/source-sans-pro';
import '@fontsource/source-sans-pro/cyrillic.css';
gulp-nunjucks-render
.gulp-nunjucks
в devDependencies.require
.nunjucksRender()
на nunjucks.compile()
.<NavLink className={({ isActive }) => isActive ? "link link--active" : "link"} to="/..." end>Ссылка</NavLink>
document.addEventListener('DOMContentLoaded', () => {
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
while (walker.nextNode()) {
const node = walker.currentNode;
if (/^hello$/i.test(node.textContent.trim())) {
node.parentNode.closest('div').hidden = true;
}
}
});
ReferenceError: gulp is not defined
gulp-sass
ошибок нет..pipe(gulp.dest('./css'))
/^[a-zA-Z\n]*$/g.test('abc\ndsa')
/^([a-zA-Z]|\r\n|\r|\n)*$/g.test('abc\ndsa')
import asyncio
from pyppeteer import launch
async def main():
browser = await launch()
page = await browser.newPage()
await page.goto('https://example.com')
html = await page.content()
print(html)
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES] });
new Promise((resolve) => resolve('много вычислений')).then(console.log);
console.log('стек');
// стек
// много вычислений