Better HN
topnewbestaskshowjobs
Log inSign up

dominic_cocch

65 karma · joined Jan 16, 2013 (13y ago) · 45 submissions

Web dev, game dev, product dev. Current hacker @instacart.

@Dominic_Cocch

Submissions

comment 4y ago · link · parent

"Orca can capture about 4,000 tons of carbon per year (for scale, that’s equal to the annual emissions of 790 cars).

Now Climeworks is building another facility that makes Orca seem tiny by comparison. The company broke ground on its Mammoth plant this week. With a CO₂ capture capacity of 36,000 tons per year, Mammoth will be almost 10 times larger than Orca."

A lot of negativity in this thread, oddly. This is a 10X improvement over a previous version. Another magnitude or two and this becomes incredible for the environment. Other solutions should also happen, but a problem as big as climate change should have many parallel solutions. We don't have time to put all our eggs in one basket.

comment 10y ago · link · parent

Very cool. We do something very similar on Instacart's site. Our main Redux store and header component track window size and scroll position so that all components on the site have that info and can react to if they need. Works wonderfully!

3.

Animating programmatically with Redux and React(tech.instacart.com ↗)

10 points · by dominic_cocch · 10y ago · 3 comments

comment 10y ago · link · parent

For now we use Rails on the server and a single backbone router for the the client side. This isn't how we want it stay. :)

We do have a couple side apps internally using React Router. We've liked it so far, but it's a pretty basic implementation.

comment 10y ago · link · parent

That is definitely one limiting aspect for some places. We actually have a similar issue, since we're a Rails shop first and foremost. Luckily there are a few tools we can use to make it work well with Rails. Maybe a future post!

I also think jQuery and other libraries with large usage are kind of Swiss army knives, so more people have more use for them.

I do believe over time React will become as pervasive as jQuery. Or possibly even the DOM api will eventually allow a similar style of building things natively. This seems to be happening to jQuery now :)

comment 10y ago · link · parent

Great point. This has to be the funniest and most confusing bug when you first encounter it!

If your list is totally static, an index will do the job. However, we usually end up appending something like an id from the db since almost nothing on Instacart is static.

comment 10y ago · link · parent

We've slowly been growing our React presence on the site for almost a year now. At this point, we're fairly close to the size of the original Backbone app as far as views are concerned.

We're still somewhat tangled in with Backbone, but it's been a great success internally. Performance-wise, development speed-wise and also developer happiness-wise we haven't hit too many snags.

comment 10y ago · link · parent

This should really only be an issue when the children of an element are all the same type of element and are at the same depth level. For example, this is very common for li elements in a ul element.

We try to keep the structure of the html so that wrappers generally keep different UI components separate from each other. In other cases, like in the example in the blog post, we just use the index from the .map() loop to add a key to every element we know will need one. React should also warn you when this is an issue.

comment 10y ago · link · parent

The backbone model api was made with totally mutable data in mind. React, on the other hand, only works well with immutable props and some mutable state in the top levels of components. That's our first issue, for sure.

Backbone also has a dependency on jQuery, which isn't very useful in React apps since mutatuing the DOM (one of jQuery's main purposes) is a no no. So most of the Backbone library isn't very useful to us anymore. I do still really enjoy the backbone way of fetching and saving models, especially in a Rails context. But I think we can get those features in other ways.

comment 10y ago · link · parent

Yes and no, really. We mostly keep our backbone models as props and keep them immutable by pure convention. You really could just call set() on one of them and cause some problems. This isn't great long term, of course. Code reviews and code style guides help here for now.

We've also at times converted backbone models to simple objects at the parent level and passed them down that way. Keeps things simpler, but we lose some of the niceties of the backbone model api. Once the models are objects, you can use componentShouldUpdate pretty defensively if you need.

We've also used throttled and debounced functions for anything which gets hit very heavily.

comment 10y ago · link · parent

Yep, it was the actual Flux library. However, we're not totally settled on that choice just yet.

comment 10y ago · link · parent

Definitely agree. In our real code we're much more sensitive of performance. This was just a quick way to show a simple way Backbone can be used with React.

I think it'd be interesting for us to do another post in the future about how we measure and improve performance within our React apps. There aren't a ton of articles about this with relation to Bakcbone, it seems.

Thanks for giving it a read!

comment 11y ago · link · parent

Whoops! Fixed in the repo now.

I can't seem to edit the title of the HN article anymore. Must be past a certain time or something.

comment 11y ago · link · parent

Calling it an MVC may be a misnomer, definitely. I know backbone often refers to itself as MV*, which is sort of funny. :)

Thanks for checking it out! I'll put some thought into the 'C' aspect of this thing.

comment 11y ago · link · parent

Yeah, for sure. I mostly started this to see if I can get a Backbone-like MVC without the heavy dependencies of jQuery/underscore/lodash/etc. The DOM selection stuff is also done relying much more heavily on native calls, so it should be much faster than jQuery at most DOM manipulation stuff. It doesn't have much/any browser support hackery built in.

For most of my work, I'll also be sticking to Backbone or something more supported/fully-featured. But I do have tinsy projects here and there that are mobile-focused one-offs that work really well with something like this. I found myself recreating this thing over and over, so I figured I'd just standardize it for me and see if anyone else felt the same need. :)

Thanks for checking it out and for the feedback!

comment 11y ago · link · parent

Yeah, I think the example itself is not a great pattern. :) If I were to redo that example, or do another example completely, I'd probably move a lot of that logic stuff into the model.

It's possible I'll add a more traditional 'controller' to the mix at some point, but I mostly wanted a similar structure to that of Backbone, without the need for jQuery/underscore.

comment 11y ago · link · parent

Why?

- Tiny footprint for mobile networks (~5kb minified).

- Extremely fast DOM query/selection engine. No need for jQuery!

- Mobile first - no legacy hackery for ie < 10.

- Great for spinning up small, mobile-specific apps.

To Do

- More useful event delegation. Currently, views must call _setElement() every time they render new DOM elements

-Currently no router for fancy SPA style urls

Installation

npm install ity

18.

Show HN: Ity – A miniscule, depedency free JavaScript MVC(github.com ↗)

12 points · by dominic_cocch · 11y ago · 10 comments

comment 11y ago · link · parent

Interview Cake is great: https://www.interviewcake.com/

comment 11y ago · link · parent

Loved Masters of Doom. I reread that one every once in a while as sort of reminder. It's an easy enough read that rereading it is fun.

comment 13y ago · link · parent

The site looks great, and I think a lot of people would want something like this. You've mentioned in other comments that you're hoping to get some kind of interest going. That, with what you've already got, is enough for me to signup.

comment 13y ago · link · parent

"For example: more men than women in the U.S. are raped"

Where does this stat come from? Most stats I've seen on this issue say that about 9/10 sexual assaults are crimes against women.

comment 13y ago · link · parent

There must be some kind of study about businesses that are loyal to employees and loud about that loyalty. How does that affect their bottom line?

Do customers/clients choose to do business with an ethical company over an unethical one? If not, maybe the bigger problem is that the employees of the world choose to do business with companies that are not good to employees.

If ethical behavior was an important factor in customer's choices I'm sure we'd see less unethical behavior by businesses. However, Walmart, Goldman Sachs, McDonalds, etc all continue to thrive after their unethical behavior is made very public.

comment 13y ago · link · parent

Cool idea and it looks very nice. After scrolling for a bit the first things I wanted to know were "How much?", which you have covered, and "Can I see a demo site?", which seems to be missing.

It would also be cool to have options other than an immediate modal, like a what's new link with a red circle containing the number of new features. Click the link and then show the modal.

comment 13y ago · link · parent

Become a full-stack dev and learn to negotiate your skills. If you want to build skills quickly, you can always become a contractor. That way you learn a new skill/framework/etc every 3-6 months. Contractors also make good money, but may not always get the greatest vacation benefits.

I live in Minneapolis, and I've noticed that the bigger companies pay more. Best Buy, 3M, Pearson, Microsoft and Oracle are notable ones near here. If you don't mind giant, slow moving corps then an easy way to make more is to work for one.

100k for a front-end or JS developer is very doable, especially if you know the MVCs and a backend language. Node.js might be a good path as its growing quickly and it's done in a language you already know.

And lastly, build cool stuff in your spare time and list it all on a nice website. Use those projects as proof and reference during salary negotiations.

comment 13y ago · link · parent

I enjoy the site and the app looks nicely designed, but the boys vs. girls thing isn't interesting to me. Is this an app to find places to hook up with people? I don't generally judge cities, venues etc by the attractiveness of the people and an app for doing that should probably be aimed at a fairly specific demographic -- probably a similar demographic to OkCupid's.

comment 13y ago · link · parent

I sincerely doubt it, since it would require a massive overhaul of everything from browsers to JS itself most likely.

The trend has been to use less HTML and more CSS to style it. HTML5 is also an attempt to extend the DOM's capabilities and also make it more semantic.

comment 13y ago · link · parent

You can learn to make a "Hello World" program in almost any language within hours, but it will probably take a few months before you can write something useful without any outside help.

I started with C# and it took me about 5 months to feel like I could do anything worth while. I've picked up JavaScript and Python since. For me, working 40 - 50 hours per week on the language I was learning, it took about 2 years to feel like I could make something someone else would use.

My learning has slowed with time, as I imagine there's less to learn, but I never feel perfect. I hope I never do, because learning to program has been incredibly rewarding and fun. Once I get tired of a language or my learning slows too much, I find another to play with.

comment 13y ago · link · parent

JavaScript is going very strong these days, mostly because it's the language of the web. Every browser supports it natively, and the language has only gotten faster as client compilers get better.

Some tech to check out: - jQuery for DOM manipulation (interacting with HTML quickly and effectively) - Underscore.js for a nice toolkit of often-used utilities - node.js for running a server, which means you can have JS on both the client and the server. - Backbone.js/Angular.js/Ember.js (and others) are Javascript MV*s: that make large, single page apps like Pandora faster, more maintainable and easier to build.

Things to look forward to: ECMAcsript 6 and 7 are in the works and include tons of new features: http://en.wikipedia.org/wiki/ECMAScript

ASM.js was recently created by Mozilla and it allows near-native speed using pure JS to run things like Unreal Engine inside the browser without the need for plugins: http://ejohn.org/blog/asmjs-javascript-compile-target/

Even more standardization. IE has finally become a fairly standards compliant browser, so JS in this browser is very likely to work in any modern browser. Coding standards are also more common and are held to more often.

Personally, the worst thing about JS in the browser is that you have to deal with the DOM. The DOM is a smelly old piece of crap that acts differently in different browsers.

12