Skip to content

Instantly share code, notes, and snippets.

View ggauravr's full-sized avatar

Gaurav Ramesh ggauravr

  • OpenTable
  • San Francisco
View GitHub Profile
@ggauravr
ggauravr / ai.conundrum.md
Created September 23, 2017 08:20
The AI Conundrum

The past few months have been a roller coaster ride for the field of Artificial Intelligence. The field that aims to marginally replicate human intelligence, has met the critical eye of many experts in the field of technology. With the likes of Stephen Hawking, Elon Musk and Mark Zuckerberg making statements about the inception of artificial intelligence in real life and its far fetched visions, the subject has to be a talk of the technology world. A few incidences in the research work carried out in various organizations like Facebook have also added to the ripples to the already unstable discussions of AI.

All these discussions have created a confusion in the minds of a few common people, about the field in general. These are the people who will be directly affected , if AI surfaces out in real life. As an enthusiast in the field, I felt the need to express my thoughts on the entire discussion. The ideas mentioned below are correct to my knowledge. In case of any discrepancy please feel

ModuleParseError: Module parse failed: /Users/gramesh/Documents/projects/start-page-nodejs/restaurant-profile/src/components/button/index.js Unexpected token (6:4)
You may need an appropriate loader to handle this file type.
| export default function Button(props) {
| return (
| <button type='button' className={styles.button}>{props.children}</button>
| );
| }
babelrc
{
@ggauravr
ggauravr / array_iteration_thoughts.md
Last active October 3, 2021 02:40 — forked from ljharb/array_iteration_thoughts.md
Array iteration methods summarized

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and

@ggauravr
ggauravr / top-grossers-2015.js
Last active February 21, 2016 21:21
A list of top 100 grossers of 2015
var titleLinks = document.querySelectorAll('table a[href^="/movies/?id"]'),
titleArray = Array.prototype.slice.call(titleLinks),
titles = titleArray.map(function(link) {
return link.innerText + '@' + link.href;
});
// titles is an array like this:
// ["Star Wars: The Force Awakens@http://www.boxofficemojo.com/movies/?id=starwars7.htm",
// "Jurassic World@http://www.boxofficemojo.com/movies/?id=jurassicpark4.htm",
// "Avengers: Age of Ultron@http://www.boxofficemojo.com/movies/?id=avengers2.htm",
@ggauravr
ggauravr / popular-movies-2015-imdb.js
Last active February 21, 2016 21:14
Most Popular Hollywood Movies of 2015 from IMDb
(function() {
'use strict';
let someVariable; // not even initialized to undefined, FTW !!
console.log(typeof someVariable); // ReferenceError
someVariable = "Defined";
})();
(function() {
'use strict';
console.log(typeof someVariable); // ReferenceError!
let someVariable = "Defined";
})();
(function() {
'use strict';
var someVariable = undefined;
var anotherVariable = undefined;
console.log(typeof someVariable); // prints "undefined"
console.log(typeof anotherVariable); // also prints "undefined"
anotherVariable = "Defined";
(function() {
'use strict';
console.log(typeof someVariable); // prints "undefined"
console.log(typeof anotherVariable); // also prints "undefined"
var someVariable;
var anotherVariable = "Defined";
})();
@ggauravr
ggauravr / undeclared-typeof.js
Last active January 21, 2016 23:52
typeof with undeclared variable
(function() {
'use strict';
console.log(typeof someVariable); // prints "undefined"
})();