Skip to content

Instantly share code, notes, and snippets.

View praveenpuglia's full-sized avatar
👨‍💻
...human in progress

Praveen Puglia praveenpuglia

👨‍💻
...human in progress
View GitHub Profile
@praveenpuglia
praveenpuglia / shadow-dom.md
Last active March 28, 2024 15:06
Everything you need to know about Shadow DOM

I am moving this gist to a github repo so more people can contribute to it. Also, it makes it easier for me to version control.

Please go to - https://github.com/praveenpuglia/shadow-dom-in-depth for latest version of this document. Also, if you find the document useful, please shower your love, go ⭐️ it. :)

Shadow DOM

Heads Up! It's all about the V1 Spec.

In a nutshell, Shadow DOM enables local scoping for HTML & CSS.

@praveenpuglia
praveenpuglia / debug.component.ts
Created March 23, 2018 14:20
Simple Component that dumps prettified data in any template.
import { Component, Input } from '@angular/core';
@Component({
selector: 'dump',
template: `
<pre><code>{{data | json}}</code></pre>
`,
styles: [
`
:host {
@praveenpuglia
praveenpuglia / webpack.config.js
Last active April 11, 2018 17:43
Simplest webpack 4 configuration to work with vuejs & scss
// Require things!
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// The configuration starts here!
module.exports = {
// The entry point for webpack to start generating a dependency graph.
entry: { index: './src/index.js' },
@larryyangsen
larryyangsen / download.js
Created May 28, 2018 14:41
axios download audio file
const { data } = await axios.get(url, {
responseType: 'arraybuffer',
headers: {
'Content-Type': 'audio/wav'
}
});
const blob = new Blob([data], {
type: 'audio/wav'
});
@swyxio
swyxio / react-router-state-manager.jsx
Last active July 26, 2022 10:43
Sync your state to your query params for copy-pastable state-in-URLs. React Router, Gatsby, and Svelte versions
// note - this was my rough working prototype, but still left some artifacts in the query params.
// todo: also need to debounce the history pushes
// see comments for production Gatsby and Svelte versions which delete nondefault keys in the query params
import React from 'react'
import queryString from "query-string"
export const connectRouterState = defaultURLState => Component => props => {
const { history, location } = props
// note: do not nest objects in URL state
@keimlink
keimlink / nvm_vs_volta.md
Last active August 19, 2021 23:19
nvm vs Volta

nvm vs Volta

A comparison of nvm and Volta to manage Node.js projects (without Yarn).

Bootstrap Project with nvm

nvm install