// repl.js
const repl = require('repl');
repl.start();
то можно с помощью .clear
node repl.js
> var a = 5;
undefined
> a
5
> .clear
Clearing context...
> a
ReferenceError: a is not defined
at repl:1:1
at ContextifyScript.Script.runInContext (vm.js:32:29)
at REPLServer.defaultEval (repl.js:342:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:537:10)
at emitOne (events.js:96:13)
at REPLServer.emit (events.js:189:7)
at REPLServer.Interface._onLine (readline.js:238:10)
at REPLServer.Interface._line (readline.js:582:8)
function laugh(num) {
return num !== 0 ? 'ha' + laugh(--num) : '!';
}
console.log(laugh(3)); // 'hahaha!'
overflow: hidden, font-size, line-height, max-height: calc(a * b)
где:<div class="text">Lorem ipsum dolor sit amet, consectetur adipisicing elit...</div>
.text {
overflow: hidden;
font-size: 16px;
line-height: 1.5;
max-height: calc(1.5em * 5);
}
function assignLocation(siteUrl, urlParams) {
function serializeParams(params) {
return Object.keys(urlParams).reduce((acc, cur) => {
return acc += `&${ cur }=${ encodeURIComponent(urlParams[cur]) }`;
}, '').replace(/^&/, '');
}
window.location.assign(`${siteUrl}?${serializeParams(urlParams)}`);
}
assignLocation('https://www.site.com/test', {
id: 324,
name: 'Jack',
age: 25,
}); // 'https://www.site.com/test?id=324&name=Jack&age=25'
function makeTree(data) {
return data.reduceRight((acc, cur) => {
return {
name: cur,
children:[acc]
};
}, { name: data.pop() });
}
let dataChapter = 'a/bb/ccc'.split('/');
let root = makeTree(dataChapter);
console.log(JSON.stringify(root, null, 2));
// {
// "name": "a",
// "children": [
// {
// "name": "bb",
// "children": [
// {
// "name": "ccc"
// }
// ]
// }
// ]
// }
<div class="wrap">
<div class="block visible">1</div>
<div class="block">2</div>
<div class="block">3</div>
<div class="block">4</div>
<div class="block">5</div>
</div>
.block {
display: none;
}
.block.visible {
display: block;
}
function toggler(selector, delay) {
let elems = $(selector),
length = elems.length-1,
i = 0;
function toggleTo(index) {
elems.removeClass('visible');
$(elems[index]).addClass('visible');
}
setInterval(function(){
toggleTo(i === length ? i = 0 : ++i)
}, delay);
}
toggler('.block', 1000);
<div style="width: 600px; height: 300px;">
<canvas id="myChart" style="width: 100%; height: 100%;"></canvas>
<div id="legend"></div>
</div>
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fill: false,
backgroundColor: "rgba(75,192,192,0.4)",
borderColor: "rgba(75,192,192,1)",
data: [65, 59, 80, 81, 56, 55, 40],
},
{
label: "My Second dataset",
fill: false,
backgroundColor: "green",
borderColor: "green",
data: [60, 159, 40, 53, 53, 65, 40],
}
]
};
var myChart = new Chart('myChart', {
type: 'line',
data: data,
options: {
legend: {
display: false
},
}
});
$('#legend').html(myChart.generateLegend())
$("#legend").on('click', "li", function(){
var i = $(this).index()
myChart.data.datasets[i].hidden = !myChart.data.datasets[i].hidden;
myChart.update();
})
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
if (getCookie('CityId') == 781) {
// do stuff
}
function changeColor(index) {
return function(e) {
e.target.style.backgroundColor = "black";
console.log('index: ', index);
}
}
function qs(selector) {
return document.querySelectorAll(selector);
}
qs('.block').forEach(function(el, i) {
el.addEventListener('click', changeColor(i), false);
});
qs('.boxer').forEach(function(el, i) {
el.addEventListener('click', changeColor(i), false);
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Document</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/4.0.3/mediaelementplayer.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<video width="640" height="360">
<source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4">
</video>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mediaelement/4.0.3/mediaelementplayer.min.js"></script>
<script>
$('video').mediaelementplayer();
</script>
</body>
</html>
undenfined
потому что вы отсылаете 204 код204 No Content — сервер успешно обработал запрос, но в ответе были переданы только заголовки без тела сообщения © wikipedia
res.status(204).send(newTask.id);
res.send(newTask.id);
background-position
. И это еще «Full-stack» спрашивает. CSS transtion и animation вам в руки. Если так необходим jQuery, то можно заюзать встроеную функцию .animate()
:$('element').animate({
'backgroundPositionY': '100px',
'backgroundPositionX': '10%',
}, 1000);
const gulp = require('gulp');
const revReplace = require('gulp-rev-replace');
gulp.task('revision', (done) => {
const manifestFile = gulp.src('path/to/manifest.json');
gulp.src('public/*.html')
.pipe(revReplace({manifest: manifestFile}))
.pipe(gulp.dest('public'));
done();
});