Skip to content

Instantly share code, notes, and snippets.

Avatar

Alisher Ergashev AliwerErgashev

  • Freelancer
  • Uzbekistan, Tashkent
View GitHub Profile
View gist:50df31e751ce648a0e3e7079fade72b4
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();
};
View js.array.of.random
function randomArray(length, min, max) {
return new Array(length).fill(0).map(function(n) {
return Math.round(Math.random() * (max - min) + min);
});
}
View gist:ab1734aca77acdff71497909dbc3dd74
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
callback: function(value, index, values) {
return '';
},
},
gridLines: {
display: false,
View gist:ceea47e92587d72d4724a46881f70c9f
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";
});
You can’t perform that action at this time.