{"id":947,"date":"2017-04-29T11:16:42","date_gmt":"2017-04-29T19:16:42","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=947"},"modified":"2017-04-29T11:16:42","modified_gmt":"2017-04-29T19:16:42","slug":"trulia-on-site-questions","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=947","title":{"rendered":"Trulia On Site Questions"},"content":{"rendered":"<p>1) How does Oauth work ? <\/p>\n<p>2) Explain journey of a URL ? <\/p>\n<p>3) How does caching work in a CDN?  How do you push a new file out to CDN? <\/p>\n<p>4) Emulate the throttle function() <\/p>\n<pre>\r\n\/\/ Allow callback to run at most 1 time per 100ms\r\nwindow.addEventListener(\"resize\", throttle(callback, 500));\r\n\/\/ Allow callback to run on each resize event\r\nwindow.addEventListener(\"resize\", callback2);\r\n\r\nfunction callback ()  { console.count(\"Throttled\");     }\r\nfunction callback2 () { console.count(\"Not Throttled\"); }\r\n\r\nfunction throttle (callback, limit) {\r\n    var wait = false;                  \/\/ Initially, we're not waiting\r\n    return function () {               \/\/ We return a throttled function\r\n        if (!wait) {                   \/\/ If we're not waiting\r\n            callback.call();           \/\/ Execute users function\r\n            wait = true;               \/\/ Prevent future invocations\r\n            setTimeout(function () {   \/\/ After a period of time\r\n                wait = false;          \/\/ And allow future invocations\r\n            }, limit);\r\n        }\r\n    }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1) How does Oauth work ? 2) Explain journey of a URL ? 3) How does caching work in a CDN? How do you push a new file out to CDN? 4) Emulate the throttle function() \/\/ Allow callback to run at most 1 time per 100ms window.addEventListener(&#8220;resize&#8221;, throttle(callback, 500)); \/\/ Allow callback to run &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=947\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Trulia On Site Questions<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-947","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=947"}],"version-history":[{"count":1,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/947\/revisions"}],"predecessor-version":[{"id":948,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/947\/revisions\/948"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=947"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}