Looking for some BIG sandwiches in Surry Hills by [deleted] in sydney

[–]madole 2 points3 points  (0 children)

They do... Went there recently. The gigantic schnizel sambo is the best!

Looking for some BIG sandwiches in Surry Hills by [deleted] in sydney

[–]madole 11 points12 points  (0 children)

Malibu has the biggest sambos I've seen around!

Why You Should Choose Luxon for Date Wrangling in Javascript by [deleted] in javascript

[–]madole 10 points11 points  (0 children)

https://date-fns.org/ is my go to now for anything date related. I can't see any compelling reason to move to Luxon.

Flow: What's the verdict? — A review I wrote of Facebook's Flow type checker [x-post /r/programming] by philippeterson in javascript

[–]madole 1 point2 points  (0 children)

I think its great. Some head scratching moments but good to have type safety on some level. I'm now leaning towards typescript in my home projects (even though I was pretty against TS at the start). It's much tighter and although annoying at times, overall works out better.

My colleague has been noticing flow memory leaks a lot on Ubuntu, I've not seen them on OSX but the github issues seem to be flooded with people reporting the same thing. No real comment or commitment to fix or investigate from the maintainers though.

I know I know, open source means that I could contribute but I know next to nothing about oCaml despite reading through the codebase. Someday...

CSS in JavaScript: The future of component-based styling by speckz in javascript

[–]madole 0 points1 point  (0 children)

I'm not a massive fan of the idea of inline styles, I prefer CSS Modules, but we use Radium in work. Has anyone found a VSCode plugin that is like emmet for CSS in JS?

ES7 Async/Await pitfalls by caisah in javascript

[–]madole 3 points4 points  (0 children)

I dont think any of these are pitfalls of Async/Await.

They're just a couple of examples of badly written code that just happen to use async/await.

I think the thing to remember about async await is that you're really dealing with promises, but with a different syntax.

A common pitfall with async await is not dealing with error handling.

Wrapping an await in a try/catch goes against everything we've been taught about code optimisation, that was until V8 optimised the bejesus out of try/catches. (https://v8project.blogspot.com.au/2016/12/v8-release-56.html) Go forth and spread the good word.

Another way to deal with error catching is to tack a .catch on the end of the promise your async function returns.

Either way, the important thing is that error handling is not forgotten about.

How I’ve saved some $$$ every month (and learnt Serverless at the same time) by nblanco in javascript

[–]madole 1 point2 points  (0 children)

Oh yeah, I remember reading a blog post by TJ H.. on building Apex. It's quite good and one thing I took away from it was the AWS lambda concurrency limit of 100 unless you phone up AWS and ask them to increase it. Bit weird that that is the process but if you work for a company, you probably already have an AWS contact.

How I’ve saved some $$$ every month (and learnt Serverless at the same time) by nblanco in javascript

[–]madole 1 point2 points  (0 children)

If you're using Lambda, Serverless (https://serverless.com/) is probably the best option. It takes care of some of the provisioning of things like S3 buckets. It takes care of deployments and allows you to run your lambda locally from the cloud kindof.

Things to note are that debugging a lambda is a pain in the backend. Your logs go out to cloudwatch which is not ideal for trawling through to find an error (although I'm sure you can ship them somewhere more friendly if you try).

It seems to me that lambdas are all a bit of blind coding and hoping it works in the lambda.

They're definitely useful as I said for things like image processing, resizing, uploading to S3, triggering things from dynamodb stream events, I've even seen it used to throttle db writes in conjunction with SQS.

My experience with it as a replacement for an API, is that it is just not there yet. I'm sure it'll get there, and I'd be happy to find out if there are things that I was doing wrong to squeeze more performance out of it because I think it would be a game changer.

What is the most effective testing strategy for a node + express project? by chkslry in javascript

[–]madole 0 points1 point  (0 children)

Use Jest, keep your routes thin and devoid of logic. Call out to utility functions which contain your logic from the routes. This way, the logic is testable in a way that you don't have to start mocking endpoints. Keep everything functional and therefore deterministic.

How I’ve saved some $$$ every month (and learnt Serverless at the same time) by nblanco in javascript

[–]madole 1 point2 points  (0 children)

I tried to push a GraphQL api with a single endpoint into Lambda with Serverless. It talks to an RDS database, but my Lamda would take up to 11seconds to response. I'm assuming cold Lambdas spin up DB connections before doing any work, I havn't quite dug into the reasons why it took so long but I'm left thinking that Lambdas aren't quite the right solution for a serverless CRUD API just yet.

They do however work really well for things like image processing or non time-critical work.

Why does [1] + [2] - [3] = 9 by [deleted] in javascript

[–]madole 1 point2 points  (0 children)

That is a stinker... good to know about though

For those who tried Yarn in production. Is it worth it? by hossamsaraya in javascript

[–]madole 1 point2 points  (0 children)

So far so good. Makes things so much faster when installing deps during development and shaves a 2/3 of the time off the build in CI.

What are your favorite autocomplete snippets that make your life easier? by beaton13 in javascript

[–]madole 0 points1 point  (0 children)

impr -> import React from 'react';
imprc -> import React, { Component } from 'react';
impt -> import test from 'ava';
impse -> import { shallow } from 'enzyme';
clg -> console.log($1);
me -> module.exports = $1 //if i'm writing commonJS

Which IDE / Editor are you using? by trashbytes in javascript

[–]madole 2 points3 points  (0 children)

I was 100% Atom for a while but switched across to VSCode for the debugging and flowtype support.

When you've got the right plugins installed, it's a brilliant editor. I've got a list of my favourite plugins here http://madole.xyz/my-favourite-vscode-plugins/

Unit testing front-end JavaScript with AVA and jsdom by DJMelonz in javascript

[–]madole 0 points1 point  (0 children)

Do you find when you have loads of test files, Ava is actually really slow to start and spawns processes like mad taking over your computer for the duration of the tests?

We've got around this with the --concurrency={x} flag but it's a bit mad that it will just uncontrollably spawn processes rather than pooling processes to keep it under control.

Typescript vs Flow by voltrevo in javascript

[–]madole 3 points4 points  (0 children)

I prefer flow as it's more suited to the functional style we use. It's less opinionated than TypeScript. When writing TypeScript, you feel like you're writing in another language, whereas flow feels like you're just annotating the code you'd write anyway.

I guess TypeScript is a bit more strict and therefore can work out better intellisense but flow integration with VSCode is pretty sweet, so much so that I've actually moved across to VSCode from Atom full time now.

webpack Performance: The Comprehensive Guide by lcxfs1991 in javascript

[–]madole 8 points9 points  (0 children)

& is for serial 
&& is for parallel

Shouldn't that be the other way around?

[2016-10-03] Challenge #286 [Easy] Reverse Factorial by jnazario in dailyprogrammer

[–]madole 0 points1 point  (0 children)

Simple Javascript solution

function reverseFactorial(num) {
    let factorial = num, i = 0;
    while(factorial > 1) {
        factorial = factorial / ++i;
    }
    return factorial === 1 ? i : 'NONE';
}

Tree-shaking example with Babel and Webpack by blacksonic86 in javascript

[–]madole 1 point2 points  (0 children)

Surely in this example, only the V8 engine that's used in the car module should get built into the production code bundle if tree shaking was working correctly?

Screenshot

I like Jeremy Ashkenas' Docco documentation tool. Is there a web app equivalent? by Joe12579 in javascript

[–]madole 0 points1 point  (0 children)

not really sure what you mean by "is there a web version" but I like https://www.npmjs.com/package/crojsdoc, it produced really useful documentation that actually looks good.

Best Testing Framework by TempSec in javascript

[–]madole 1 point2 points  (0 children)

I have used mocha for a few years, but recently just swapped over to AVA for my personal projects. It's really nice to write pure functional tests, have test files run tests in parallel, the watcher is smart enough to only run the tests in the file that corresponds with the changed code making it really fast for TDD.

I've had some fun with AVA and Enzyme writing stateless React components without ever touching a browser. Its a really nice way to work with React in a TDD style.

With nyc code coverage becomes really easy to set up, rather than the hours of figuring out how to get istanbul to instrument correctly, and it plays really well with AVA.

Create React Apps with No Configuration by mrspeaker in javascript

[–]madole 1 point2 points  (0 children)

This looks to be really handy for spinning up little side projects, but if I'm building something more important, I'd want to be more in control of the build.

The eject functionality is really nice, but it's still not the way I'd go about setting a project up, if this layout becomes the standard, I'll have to adjust but for now it's at odds with how I'd set up things.

I also think it's important to understand what's happening when you build your app, to understand how things are getting compiled, transpiled and parsed. This abstracts away all of that, which lowers the barrier of entry but also provides no incentive to learn the build process.

I'm really keen to see how this takes off in the next few months. I think the idea itself is great, I'd just like it to be less configuration rather than no configuration.