Skip to content

Instantly share code, notes, and snippets.

View vasanthk's full-sized avatar

Vasa vasanthk

View GitHub Profile
@vasanthk
vasanthk / double-fetch-triple-fetch.md
Created March 1, 2020 07:19 — forked from jakub-g/double-fetch-triple-fetch.md
Will it double-fetch? Browser behavior with `module` / `nomodule` scripts
@vasanthk
vasanthk / react.md
Created January 1, 2019 19:21 — forked from lpalmes/react.md
React and Reconcilers in Reason

React

This is the base of all projects and it will include the foundation for all potential react-based projects in Reason.

This base package should include a ReasonReact api to promote collaboration and familiarity with people using a ReasonReact, and for the modern world of React this should also include a Hooks api that currently revery uses.

React module

All blocks in Jsx are of type React.reactElement. This reactElement should represent:

@vasanthk
vasanthk / latency.txt
Created February 1, 2017 21:26 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@vasanthk
vasanthk / 0 basics.md
Created December 16, 2018 20:38 — forked from threepointone/0 basics.md
css-in-js

A series of posts on css-in-js

0. styles as objects

First, an exercise. Can we represent all of css with plain data? Let's try.

let redText = { color: 'red' };
@vasanthk
vasanthk / README.md
Created December 15, 2018 16:01 — forked from roachhd/README.md
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

@vasanthk
vasanthk / 1. bad.js
Created December 14, 2018 08:15
Avoid Creating Unnecessary Promises!!
const { promisify } = require('util')
const timeout = promisify(setTimeout)
async function bar() { await timeout(1000) }
// The idea here is that we don't know if foo
// is going to return a Promise or not, so just
// in case, force it to return a Promise.
// Unfortunately, doing it this way creates
// quite a few additional unnecessary Promises
@vasanthk
vasanthk / CordovaDevtools.md
Created August 6, 2018 23:38 — forked from Mohamed3on/CordovaDevtools.md
Inspect Cordova/Ionic apps with Chrome Devtools
  1. Connect your Android device
  2. Make sure it's working correctly with adb and you can find it when you run adb devices
  3. In the directory of your app, run cordova run android --device, Now the app will run on your device
  4. Go to chrome://inspect/#devices on your Chrome browser, and select your app and click inspect
  5. Now you can inspect the HTML/CSS, and debug your JS with ease!
@vasanthk
vasanthk / coordinating-async-react.md
Created May 20, 2018 19:45 — forked from acdlite/coordinating-async-react.md
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

@vasanthk
vasanthk / prepack-gentle-intro-1.md
Created May 8, 2018 21:52 — forked from gaearon/prepack-gentle-intro-1.md
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@vasanthk
vasanthk / quiz.md
Created April 23, 2018 22:47 — forked from gaearon/quiz.md

A top-level App component returns <Button /> from its render() method.

  1. What is the relationship between <Button /> and this in that Button’s render()?

  2. Does rendering <Button><Icon /></Button> guarantee that an Icon mounts?

  3. Can the App change anything in the Button output? What and how?