Skip to content

Instantly share code, notes, and snippets.

View paramjeetdhiman's full-sized avatar
🇮🇳

Paramjeet Dhiman paramjeetdhiman

🇮🇳
View GitHub Profile
@paramjeetdhiman
paramjeetdhiman / deep-merge.js
Created July 6, 2023 16:38 — forked from ahtcx/deep-merge.js
Deep-Merge JavaScript objects with ES6
// ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it
// ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge`
// Merge a `source` object to a `target` recursively
const merge = (target, source) => {
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
for (const key of Object.keys(source)) {
if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key]))
}
@paramjeetdhiman
paramjeetdhiman / Sublime Rainbowth Brackets
Created January 28, 2022 08:05
Rainbowth Package Sublime - Add file in this location sublime-text/User/Rainbowth.sublime-settings
{
"languages": ["c++", "c", "python","lisp", "scheme", "clojure", "clojurescript", "hylang","js","sass","scss"],
"palettes": {
"default": ["#3F9101","#0E4A8E","#BCBF01","#BC0BA2","#61AA0D","#3D017A","#D6A60A","#7710A3","#A502CE","#eb5a00"],
"Dracula": ["#E8BA36","#54A857","#359FF4","#5060BB","#179387","#A5BE00","#005FA3","#DB7100","#FFC666","#38FF91"],
"One Dark": ["#E8BA36","#54A857","#359FF4","#5060BB","#179387","#A5BE00","#005FA3","#DB7100","#FFC666","#38FF91"]
},
" vim-plug
call plug#begin('~/.vim/plugged')
" plugin section
Plug 'pangloss/vim-javascript'
Plug 'leafgarland/typescript-vim'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'prettier/vim-prettier', { 'do': 'yarn install', 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] }
let g:prettier#autoformat = 0
@paramjeetdhiman
paramjeetdhiman / readme.md
Created August 14, 2021 14:19 — forked from brltdxd/readme.md
Tailwind UI Updated Color Palette - Hex Codes
const [MyArray, setMyArray] = useState([]);
const [sortStatus, setSortStatus] = useState(true);
const handleAccuracySort = () => {
const data = MyArray;
if (sortStatus) {
let sorted = data.sort((a, b) => a[1] - b[1]);
setConfScores(sorted);
setSortStatus(!sortStatus);
} else {
(function(data) {
var canvas = document.getElementById("toplevelGraphCanvas");
var rect = canvas.getBoundingClientRect();
var ctx = canvas.getContext('2d');
var type = "mousemove";
canvas.dispatchEvent(
new MouseEvent(type, {
clientX: rect.left + data.x,
var canvas = document.querySelector("#toplevelGraphCanvas");
canvas.addEventListener("mousemove", function(evt){
var rect = canvas.getBoundingClientRect();
let x = evt.clientX - rect.left;
let y = evt.clientY - rect.top;
console.log(x,y)
});
let boom = {
a: {x: 1200, y:230},
b: {x: 150, y: 250}
};
(function (data) {
var canvas = document.getElementById("toplevelGraphCanvas");
var rect = canvas.getBoundingClientRect();
var type = "mousedown";
(function (data) {
var canvas = document.getElementById(data.id);
var rect = canvas.getBoundingClientRect();
var type = 'mousedown';
canvas.dispatchEvent(
new MouseEvent(type, {
button: 2,
buttons: 2,
clientX: rect.left + data.x,
(function (data) {
var canvas = document.getElementById(data.id);
var rect = canvas.getBoundingClientRect();
var type = 'mousedown';
canvas.dispatchEvent(
new MouseEvent(type, {
clientX: rect.left + data.x,
clientY: rect.top + data.y,
})
);