Skip to content

Instantly share code, notes, and snippets.

@jayasimhan
jayasimhan / machine.js
Last active May 31, 2020 04:17
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jayasimhan
jayasimhan / machine.js
Last active March 2, 2020 23:03
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jayasimhan
jayasimhan / twitter.js
Created April 28, 2018 09:23
Example twitter api call including construction of the auth header
const CONSUMER_KEY="consumer_key";
const CONSUMER_SECRET="consumer_secret";
const ACCESS_TOKEN="access_token";
const ACCESS_TOKEN_SECRET="access_token_secret";
const crypto = require('crypto');
const qs = require("querystring")
const request = require("request");
@jayasimhan
jayasimhan / GTD-Mindsweep-list.md
Last active June 4, 2021 12:35
GTD Mindsweep list

GTD Mindsweep list

Professional

Projects started, not completed

Projects that need to be started

"Look into . . ." projects

Commitments/promises to others

Keybase proof

I hereby claim:

  • I am jayasimhan on github.
  • I am jayasimhan (https://keybase.io/jayasimhan) on keybase.
  • I have a public key whose fingerprint is 00F0 A901 2A82 85AD FA35 A348 A665 A8F9 01B8 9929

To claim this, I am signing this object:

-- Continuous View
CREATE STREAM s0 (x int);
CREATE CONTINUOUS VIEW cv AS
SELECT x, count(*) FROM s0 GROUP BY x;
INSERT INTO s0 (x)
SELECT x % 10 FROM generate_series(1, 1000) AS x;
-- Continuous Transform
CREATE STREAM s1 (x int);
CREATE CONTINUOUS TRANSFORM ct AS
@jayasimhan
jayasimhan / gist:ca4062147df64d223d07
Created April 9, 2015 00:41
My learnings on React

From this email thread on designing React UI and talking to a few folks, I understand that the disagreement largely is on passing the entire state object to all components.

I think all components should not share the same state object. Here's why.

Pure Components

Like pure functions. When we pass the a common state variable to all components, the render method would be triggered even for unrelated changes. The Virtual DOM does intelligent work, but that is only after React has regenerated the component (in the Virtual DOM). It might be cheap, but not necessary. In the unavoidable scenario where we have to pass state information to a componenty that it doesn't need, we should use the PureRenderMixin or implement shouldComponentUpdate on every(or selected nodes) component to avoid re-rendering everything all the time. Everywhere else we should just tie the component to the piece of state that it relies on.

Reuse

@jayasimhan
jayasimhan / login-message
Created April 8, 2014 19:28
show a message in login page
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "I belong to Jay Masilamani. Please call xxx-xxx-xxxx if you find me."