Skip to content

Instantly share code, notes, and snippets.

View vviikk's full-sized avatar
🙃

Vik Ramanujam vviikk

🙃
View GitHub Profile
@vviikk
vviikk / CSS in JS (advantages, drawbacks, and how styled-components is hopefully the answer).md
Created November 15, 2018 10:20
CSS in JS (advantages, drawbacks, and how styled-components is hopefully the answer)

CSS in JS (advantages, drawbacks, and how styled-components is hopefully the answer)

Someone is going to unify these three different syntaxes and write a language that just addresses the web platform directly, and it's going to be insanely popular.
—[Jeremy Askenas][rise-of-the-transpilers], creator of coffeescript, 2015

TL;DR; styled-components FTW!

The journey to styled-components has been long, but with it's simplicity, tooling and level of adoption, it's the future of CSS in JS, and IMHO, the emerging standard that is about to stay. I can mention the disadvantages of CSS in JS, but most of them will not be valid if we're using styled-components. The topic is probably one of the fastest evolving in web development, so I hope you'll see:

  • advantages of CSS in JS
@vviikk
vviikk / userChrome.css
Last active April 16, 2023 13:02
userChrome.2021.css
/* Hide horizontal tabs at the top of the window #1349 */
#TabsToolbar {
visibility: collapse !important;
}
/* For only Tree Style Tab sidebar #1397 */
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
display: none !important;
}
@vviikk
vviikk / index.pug
Last active March 27, 2023 09:46
A Simple CSS custom properties naming convention
h1 A simple CSS Custom properties naming convention
p.large Discussed in detail in my article on medium.com.
p
a.button View on Medium
<script src="https://gist.github.com/vviikk/fde0fced50ee27780189dd7bc028e63d.js?file=style.css"></script>
@vviikk
vviikk / index.html
Created January 7, 2019 21:52
Electron Fiddle Gist
<html>
<head>
<style>
</style>
</head>
<body>
<form name="form">
<input name="input" placeholder="https://messenger.com/" value="https://messenger.com">
<button type="submit">submit</button>
</form>
@vviikk
vviikk / two-finger-history-navigation.js
Last active February 18, 2021 23:29
two-finger-history-navigation.js
// This script is responsible for implementing the functionality of
// going back/forward in the navigation history when the user scrolls
// the page left/right using the touchpad.
// Each horizontal scroll event is intercepted and if the total motion
// within a given time is greather than a threshold, the code triggers
// a history.back() or .forward()
// Settings are handled by the background script bg.js.
function twoFingerScroll() {
// define a motion accumulator
@vviikk
vviikk / smooth-scrolling.js
Last active February 18, 2021 17:38
Smooth scrolling you can add inject into any Nativefier app
// ==UserScript==
// @name Smoothscroll
// @author Creec Winceptor
// @description Smooth scrolling on pages using javascript
// @namespace https://greasyfork.org/users/3167
// @include *
// @version 9.6
// ==/UserScript==
const Smoothscroll = {};
@vviikk
vviikk / nicely-named-fluid-typography-with-custom-properties.css
Last active January 17, 2020 21:08
Better Fluid type with custom properties
:root {
/* CONSTANTS */
--FONT-SIZE-MIN: 16;
--FONT-SIZE-MAX: 26;
/* Notice, no calcs used yet */
--FONT-SIZE-MIN-PX: (var(--FONT-SIZE-MIN) * 1px);
--FONT-SIZE-MAX-PX: (var(--FONT-SIZE-MAX) * 1px);
--BROWSER-WIDTH-MIN: 300;
@vviikk
vviikk / userChrome.2019.aug
Created August 7, 2019 06:09
Firefox side tabs
Toolbar {
visibility: collapse !important;
}
/* For only Tree Style Tab sidebar #1397 */
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
display: none !important;
}
@vviikk
vviikk / index.html
Created January 9, 2019 08:15
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<style>
.tabbar {
position: absolute;
left: 0;
top: 0;
@vviikk
vviikk / index.html
Created January 7, 2019 21:33
Electron Fiddle Gist
<html>
<head>
<style>
</style>
</head>
<body>
<form name="form">
<input name="input" placeholder="https://messenger.com/" value="https://messenger.com">
<button type="submit">submit</button>
</form>