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
<!doctype html>
<html>
<head>
<title>Rich Text Editor - FROM MDN!</title>
<script type="text/javascript">
var oDoc, sDefTxt;
function initDoc() {
oDoc = document.getElementById("textBox");
sDefTxt = oDoc.innerHTML;
@praveenpuglia
praveenpuglia / .csscomb.json
Last active August 29, 2015 14:20
CSSComb Config for Sublime Text 3
{
"config": {
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": false,
"leading-zero": true,
@praveenpuglia
praveenpuglia / Package Control.sublime-settings
Created June 22, 2015 17:47
Installed Packages for sublime text
{
"in_process_packages":
[
],
"installed_packages":
[
"BracketHighlighter",
"Emmet",
"GitHub Markdown Snippets",
"Handlebars",
@praveenpuglia
praveenpuglia / es2015-features.js
Last active September 29, 2015 09:25
Features Examples of ES2015 - Some written, some curated.
/*======================================================
= ARROW FUNCTIONS & LEXICAL this =
======================================================*/
// OLD WAY
var squares = [1,2,3,4,5,6,7,8,9].map(function(value){
// this === window
return value * value;
});
// NEW WAY

Thanks for replying to me! :)

I really didn't know about the recommendation process back then. It's pretty recent that I came to know about it. I am not sure if any of the suggestion helps at the moment since it's now a recommendation.

I am also sure that the working group must have thought about exhaustive scenarios so I may not even be making a point.

I know $ or @ couldn't be used since they were already getting used in preprocessors and @ specifically, I feel, wouldn't go with the existing syntax of CSS.

I met Chris Lilley few days ago and I came to know that $ could be used but it would create multiple problems.

function hcf(n1, n2){
var hcf = (n1 > n2) ? findHcf(n2, n1) : findHcf(n1, n2);
console.log("HCF of ", n1, " & ", n2, " is ", hcf);
}
function findHcf(b, a) {
console.log("Divisor : ", b," Dividend: ", a);
var q, r;
q = Math.floor(a/b);
r = a - b*q;
@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' },
@praveenpuglia
praveenpuglia / no-dispatch.ts
Last active April 25, 2018 18:25
Do not dispatch an action from an ngrx effect
@Effect({ dispatch: false })
logout$: Observable<Action> = this.actions$.pipe(
ofType(UserActionTypes.LOGOUT),
tap(action => {
delete window.localStorage.user;
this.router.navigate(['login']);
})
);