Skip to content

Instantly share code, notes, and snippets.

@guptag
guptag / Angular 2
Last active July 21, 2017 16:58
Angular2/React links
Data Binding - http://plnkr.co/edit/TMm03jZH7f8p6fuCL9Kd?p=preview
// On Push
https://www.lucidchart.com/techblog/2016/05/04/angular-2-best-practices-change-detector-performance/
http://pascalprecht.github.io/slides/angular-2-change-detection-explained/#/122
https://www.lucidchart.com/techblog/2016/11/08/angular-2-and-observables-data-sharing-in-a-multi-view-application/
http://blog.angular-university.io/onpush-change-detection-how-it-works/
http://stackoverflow.com/questions/41364386/whats-the-difference-between-markforcheck-and-detectchanges
@guptag
guptag / git
Last active October 12, 2016 17:54
Git
Fork/Sync - https://2buntu.com/articles/1459/keeping-your-forked-repo-synced-with-the-upstream-source/
Commit Graph --> git log c15020f --graph --oneline --decorate
@guptag
guptag / dates and timezones
Created February 3, 2016 19:58
MomentJS - DateTime Kung Fu
* Browser display of new Date() or moment().toDate() is always local with info of GMT offset (pacific for e.g)
* Anytime format() is called after toDate(), date is converted to local
* date object always hold local time, it is .utc.format() or .tz("...").format() converts the date into that timezone
* to load UTC time, make sure the date format has ended with "Z"
var m = moment(new Date("2015-12-31 12:00:00")) // no Z, so local date
m.format('MMMM Do YYYY, h:mm:ss a'); --> "December 31st 2015, 12:00:00 pm"
m.utc().format('MMMM Do YYYY, h:mm:ss a'); --> "December 31st 2015, 8:00:00 pm"
m.tz("US/Eastern").format('MMMM Do YYYY, h:mm:ss a'); --> "December 31st 2015, 3:00:00 pm"
m.tz("US/Eastern").toDate(); --> Thu Dec 31 2015 12:00:00 GMT-0800 (PST)
Export Google spreadsheets to json
@guptag
guptag / Design-Fonts
Last active September 5, 2015 17:39
Design
https://www.google.com/fonts/specimen/Varela+Round
http://projectsthehardway.com/ (headers)
----
https://www.upwork.com/o/jobs/job/Thinkscript-Thinkorswim-formula-for-scanner_~0110c1f124fca5c7cd/
Gotham Book
-----
http://imba.io/
@guptag
guptag / Rendering Performance
Last active May 13, 2016 16:33
Chrome - Performance
http://addyosmani.com/slides/performance/jqueryto/slides.html#30
http://www.html5rocks.com/en/tutorials/speed/layers/
https://plus.google.com/+AddyOsmani/posts/gv92WXBBkgU
https://developer.chrome.com/devtools/docs/timeline
http://stackoverflow.com/questions/10592070/what-is-the-blank-space-in-chromes-new-vertical-timeline
https://plus.google.com/+NatDuca/posts/BvMgvdnBvaQ?e=-RedirectToSandbox
http://aerotwist.com/blog/on-translate3d-and-layer-creation-hacks/
http://wilsonpage.co.uk/preventing-layout-thrashing/
http://vimeo.com/69385032
@guptag
guptag / React Class Template
Last active November 17, 2016 12:02
ReactJS
// React Class template with inlined documentation from
// http://facebook.github.io/react/docs/component-specs.html
var component = React.createClass({
/***** Core Methods *****/
render: function () {
// Returns ReactComponent
@guptag
guptag / Bindings
Created January 21, 2014 17:02
Sublime User Key Bindings
[
{ "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} },
{ "keys": ["ctrl+right"], "command": "move", "args": {"by": "words", "forward": true} },
{ "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} },
{ "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "words", "forward": true, "extend": true} },
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },
@guptag
guptag / Javascript tracer
Last active January 23, 2023 17:40
Trace the execution path of the client-side code as it executes.
/*
TRACER.js
Trace the execution path of the client-side code as it executes
(super helpful in large client-side codebase esp for new members in the team).
This tool can be helpful :
- to trace the code path for a corresponding UI action in the web app.
- to trace the code path when a global event occured (like resize browser window).
@guptag
guptag / Q.js Examples
Last active April 4, 2021 06:22
Q.js examples - Small snippets to understand various api methods in Q.js
//To run Q.js examples:
// 1. Open a new browser tab in Chrome and turn on developer toolbar (or open any http site).
// 2. Copy/Paste this gist in the console and hit enter to run the snippets.
// Based on the inspiration from samples @ https://github.com/kriskowal/q
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////