Skip to content

Instantly share code, notes, and snippets.

View gokulkrishh's full-sized avatar

Gokulakrishnan Kalaikovan gokulkrishh

View GitHub Profile
@gokulkrishh
gokulkrishh / index.js
Last active December 10, 2021 20:17
List the visual studio code installed extensions (https://git.io/installed-vscode-extenstions)
#!/usr/bin/env node
const { exec } = require('child_process');
exec('code --list-extensions', (err, stdout) => {
if (err) console.log('Error occurred', err);
const extensions = stdout.split('\n').filter(extension => extension);
console.log(`\n✅ Installed VS Code Extensions: ${extensions.length} \n`);
@gokulkrishh
gokulkrishh / git-io-custom-url.md
Last active November 12, 2020 20:31
Create a custom (repo name) name in git.io
curl https://git.io/ -i -F "url=<repo-url>" -F "code=<repo-name>"

Above command will give you something like git.io/repo-name

BEM - Block, Element, Modifier

1. Block
----------------------------------------------

Eg: menu

<ul class="menu"></ul>
  1. Elements
@gokulkrishh
gokulkrishh / sw.js
Last active July 21, 2020 14:38
Service worker fetch event
//After install, fetch event is triggered for every page request
self.addEventListener("fetch", function (event) {
console.log("Request -->", event.request.url);
//To tell browser to evaluate the result of event
event.respondWith(
caches.match(event.request) //To match current request with cached request it
.then(function(response) {
//If response found return it, else fetch again.
return response || fetch(event.request);

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

{
"cssconf": {
"location": {
"date": "September 12, 2014",
"country": "Germany",
"city": "Berlin",
"venue": "Radialsystem V",
"lat": 52.51039,
"long": 13.42864
},
@gokulkrishh
gokulkrishh / index.md
Last active March 2, 2020 05:17
Useful javascript util functions

Useful javascript util functions

Table of contents

Flatten Object

@gokulkrishh
gokulkrishh / README.md
Last active January 27, 2020 04:24
How to debug/develop npm package

How to debug/develop npm package

Source

npm link

Destination

@gokulkrishh
gokulkrishh / SCSS.md
Created August 10, 2017 14:17 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@gokulkrishh
gokulkrishh / snippets.js
Last active March 26, 2019 07:46
Useful snippets for web development.
// Add any library to application
((library = 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.min.js') => {
var element = document.createElement('script');
element.src = library;
element.type = 'text/javascript';
document.head.appendChild(element);
})();
// Trace any properties
const traceProperty = (object, property) => {