Skip to content

Instantly share code, notes, and snippets.

View AliwerErgashev's full-sized avatar

Alisher Ergashev AliwerErgashev

  • Freelancer
  • Uzbekistan, Tashkent
View GitHub Profile
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
function randomArray(length, min, max) {
return new Array(length).fill(0).map(function(n) {
return Math.round(Math.random() * (max - min) + min);
});
}
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
callback: function(value, index, values) {
return '';
},
},
gridLines: {
display: false,
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
// dark mode
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
const newColorScheme = e.matches ? "dark" : "light";
});