HNHacker News
TopNewBestAskShowJobs

codecurve

1,560 karma · joined January 18, 2012

[ my public key: https://keybase.io/danprince; my proof: https://keybase.io/danprince/sigs/8AYDk4-RDKmDfqhI3Zvr4m2aPQy1DeZ86fGOs6WbGLU ]
submissionscomments
codecurve··on 2017 JavaScript Rising Stars
Because a framework can't bring new language primitives, such as types?
codecurve··on Ask HN: What software/service helps you be an effective remote developer?
Slack for the noisy chat.

GitHub issues for taggable discussions.

Zoom.us for calls and beer hangouts.

Google Docs for collaborative writing.

Screenhero for pairing/reviewing together.

codecurve··on Fantastic DSLs and where to find them
Sure, no arguments there. It does save time in JavaScript and a large part of that is because the language has been designed around mutability.

Part of that trade-off is that JavaScript can't make the same guarantees about what happens when you pass an object into a function. It's harder to be confident that a given program is correct.

Immutability is just a part of the "simple made easy"[1] ethos of Clojure and I think most Clojure programmers will argue that taking the time to understand that philosophy _is_ worth the investment.

[1] https://www.youtube.com/watch?v=rI8tNMsozo0

codecurve··on Fantastic DSLs and where to find them
Few points on immutability and Clojure.

The abstraction that hides mutable data structures is transient[1], not vars, refs, agents and atoms.

Those abstractions are all to do with mutable references, not mutable data. They're there to make sure that you have safe ways to coordinate state in concurrent environments.

I agree that immutability can be annoying in languages that weren't designed with it in mind, but the languages that were almost always make it easier, safer and performant to create copies rather than mutate data.

If you're writing Clojure or Haskell and you think you're going to save yourself time by "just creating a map and mutating its structure" then you're misunderstanding the purpose of the language. These constraints are what enable the guarantees and contracts those languages make.

[1]: https://clojure.org/reference/transients

codecurve··on Next.js 2.0
Because both are opinionated ways to get a React project going without having to configure any tooling yourself.

Next.js also focuses on client side JavaScript, but happens to render at the server first, so that there's something there for users before the client bundles have downloaded, parsed and been executed.

You could think of it as a more configurable create-react-app that supports server side rendering, with a convention over configuration approach to pages and links.

codecurve··on Terraform 0.9
We had a tough time with Terraform on AWS. The syntax is undeniably better than Cloudformation and having the concept of modularity built in is a big win.

However, when things went wrong we ended up with cryptic error messages and often when `terraform up` failed, then `terraform destroy` would fail too, leaving us using AWS console to jump in and start clearing up the resources. Particularly painful because AWS has no awareness that your stack came from a Terraform config, so you have to navigate through the subresource menus destroying things one-by-one.

We ended up switching over to Cloudformation. The extra verbosity does suck, but the tooling for running/updating stacks feels far safer. We can review the changeset when we update the stack, view a realtime event log as resources are created, deleted or updated, and best of all we can always tear the stack down from a single point.

codecurve··on Classes Are Making Me Sad
Wonder what the language would now look like if we had some dedicated syntax for Object.create instead of hiding the underlying prototype mechanism under the familiar class syntax.

    typeof (class {}) === "function"
This is almost guaranteed to be a future WAT[1] moment for the next generation of JavaScript programmers.

I can already see that a big part of the appeal for classes is that they keep your code looking neat and succinct (as opposed to throwing .prototype and Object.create all over the place.

I'd much rather be writing code that looked something like the below, than having to think about super, static, own properties, constructors, private fields etc.

   // provided by some view library
   let Component = {
     state: null,

     setState(state) {
       Object.assign(this.state, state);
       this.forceUpdate(); 
     }

     // ...
   }

   let Counter is Component {
     get state() {
       return { count: 0 };
     },

     inc() {
       let { count } = this.state;
       let { step } = this.props;
       this.setState({ count: count + step });
     },

     render() {
       let { count } = this.state;
       return <button onClick={this.inc}>{count}</button>;
     }
   }

   render(<Counter step={2} />);
Although it introduces a new keyword, the abstraction ends up being minimal, because it's just a sugar for the existing Object.create.

   // let Counter is Component
   let Counter = Object.create(Component);
This is obviously a very half baked idea, but I have programmed quite happily with Object.create for a long time without ever _needing_ to use classes. If we had better tools for working with prototypes then maybe we wouldn't have to pretend the language had classes instead.

[1]: https://www.destroyallsoftware.com/talks/wat

codecurve··on Static Site Post Scheduler: Using AWS Lambda and Serverless to Schedule Blog Posts
Simple != easy.

Wordpress and co are easy, but they're fundamentally much more complex than static sites.

Jekyll is quite simple, but it can be hard to use in comparison.

codecurve··on ECMAScript bind operator proposal
Already had some time on the front page on HN today, but I just released https://zaphod.surge.sh/ which uses it.
codecurve··on Zaphod: Clojure's API for JavaScript's Data Structures
Totally hear what you're saying and I think JS would be better off without `this` in the first place. Clojure's threading macros are another great solution to the chaining problem.

That said, `this` is here to stay and to me, function bind feels like a pretty great way to write code that feels natural, without the danger of extending the prototypes for Array and Object.

codecurve··on Zaphod: Clojure's API for JavaScript's Data Structures
Ah, lodash and lodash/fp are slightly different packages. https://github.com/lodash/lodash/wiki/FP-Guide
codecurve··on Zaphod: Clojure's API for JavaScript's Data Structures
Yeah, so do lodash/fp and a handful of other solid libraries.

The difference is that this sticks as close as possible to Clojure's API _for data_, rather than trying to be a functional programming utility belt.

codecurve··on Zaphod: Clojure's API for JavaScript's Data Structures
tl;dr I wanted Clojure's simplicity with Lodash's flexibility, something easier to integrate into existing projects than ImmutableJS or Mori.

Function bind syntax will be controversial, so I've also included a compatibility interface, so you can use Zaphod from Babel-free JavaScript (https://zaphod.surge.sh/compat/)

codecurve··on From Mac to Linux: Web Development with Linux
https://galliumos.org/ has done a lot for this space. They're doing a great job at normalizing a *buntu distro across the various chromebook hardware.
codecurve··on From Mac to Linux: Web Development with Linux
Try kwm[0]. It's not perfect, but as someone who's just switched in the opposite direction, it's the closest thing I've found to i3.

[0]: https://github.com/koekeishiya/kwm

codecurve··on From Mac to Linux: Web Development with Linux
I recently switched to using a Mac (for work) after 5-6 years only using Linux. Again and again the most painful aspect of the Apple ecosystem is that Apple have already decided what is going to be best for me.

By default, it's impossible to use workspaces without frequent switches to the trackpad, which wouldn't be so bad, but without installing third party software it's not really possible to create shortcuts or start remapping keys either. Even once you've installed and started Kwm, Karabiner and Seil, the botched keyboard layout renders the Alt key useless for wm shortcuts. There's not even a keyboard shortcut that makes a window fullscreen without removing it from its workspace!

So much of the system lives in this unconfigurable space. As a Linux user, if my window manager isn't working for me, then I just install another one and start again with a fresh _and customizable_ blank slate.

Ironically the things that don't frustrate me about the chance from Linux to Mac are the things the author identified in the article. My editor works just the same in both OSes and Homebrew could be a lot worse.

And I get it, the OSX experience is a system that is averaged out to be comfortable and intuitive for everyone from musicians to graphic designers to programmers and business people. As a result, the user experience punishes power users the most.

If you primarily identify as a programmer and use a Mac on a day-to-day basis, go pick up a cheap Chromebook, throw a linux distro on it, and see how it feels. If it's not quite right, tweak it. If you get it working, great - you've just saved yourself ~$1000 and a vendor lock-in. If not, all you've lost is $150 and a few hours of your life.

codecurve··on UK scientists dropped from EU projects because of post-Brexit funding fears
I just finished an EU funded CompSci Masters degree in Wales, the poorest country in the UK and it's devastatingly sad to think that once the EU research funding stops, those opportunities will be gone forever for future students coming through the department.

There aren't enough large tech companies in the area for there to be any sponsored degrees available, which probably means that when the funding finishes, the research will start to dry up and the interesting researchers will leave with it. Take away the research and what's left is a department of third-rate lecturers. That's not an inspiring way to learn.

Will the NHS get some of the £350m? Maybe, maybe not. It's likely to be up for discussion. Will the post-Brexit government allot research funding for CS departments in North Wales? Not a chance.

codecurve··on Ask HN: How do you decide what to learn next?
Just to add to this, pick up an Amazon Kindle. There's almost no-where you can't read when your entire library fits in a pocket or a rucksack. I've been travelling for most of this year and my kindle comes second to only my laptop on the list of essentials.
codecurve··on Ask HN: How do you decide what to learn next?
Read. And I don't just mean books (although they are a great place to start). Read technical blogs, read documentation, read other people's code. Seek out challenging reads that seem overly ambitious and use them to find out what your unknown-unknowns are, then use that knowledge to steer your learning.
codecurve··on Now: realtime Node.js deployments
Any chance of some clarification around the limits of the free tier?

> 20 FREE deploys per month

So I can only run the `now` command 20 times each month? What are you using to track how many times I've run it already? IP? NPM username? Package name?

>1MB size limit per file

Is this at deployment time or is this also enforced at runtime? If I deploy a 900kb sqlite file, then add 200kb of records to it at runtime, what's going to happen?

> Perfect for open-source demos, classrooms, tutorials & testing.

Are 20 deploys per month really enough to use in a teaching context? I'd love to use this tool in the web tech module I teach at my university, but I think most students would burn through 20 deploys in a week, let alone a month. Is there any chance this limit could be re-thought for teaching purposes?

I wouldn't mind if some of the other restrictions were changed, but free tiers that halt development til the start of next month don't sound great for learning to me.

codecurve··on GitLab Pages
Just for reference—you can achieve this if you run your site behind CloudFlare. I run my own blog this way.
codecurve··on Oculus Rift is Shipping
It's interesting to see games for the HTC Vive tackling this problem by forcing players to be static, or move around the environment with a sort of point-and-click style teleport.

From what I've seen, players pick it up fairly naturally and it doesn't seem to impede gameplay. The major drawback would be that games need to be designed specifically with this in mind.

codecurve··on GalliumOS – Lightweight Linux for Chromebooks
I found a model of the Acer C720 with 4GB RAM and it's been my only computer for the last 5 months. The 32GB SSD is not great, but xubuntu + all my dev environment still leaves 40% free. Browsing is fine, never had performance problems when editing either. It runs Clojure on the JVM without issues, but I've never tried/needed to run a full blown IDE. That said, it happily runs Minecraft on medium settings.

There are still a few hiccups with hibernation. Using a tiling WM meant I needed to remap all of the chrome keys to get stuff like brightness and volume working.

I got it refurbished for £120 (~$170) before I set off backpacking in Asia and it's been the perfect laptop. Lightweight and decent battery life.

I do a lot of vector drawing and the trackpad fidelity isn't great, but that's hardly something you can ask for on such a cheap little machine.

codecurve··on Grd – A CSS grid framework using Flexbox in 512 bytes gzipped
So use Bower/NPM then. Or use npmcdn.com.

https://npmcdn.com/grd@1.2.0/dist/grd.css

codecurve··on Ask HN: What's your primary development laptop?
I've been backpacking around Asia working with an Acer C720 Chromebook. 2GB RAM, 32GB SSD, 11.6" display. It took a few days to get used to the smaller screen and keyboard, but since then it's been fantastic. Cost about £120 refurbished from eBay.

Battery lasts for 5-6 hours. The laptop itself has survived intense use travelling through India, Sri Lanka, Thailand and Cambodia, including having the corner of the screen melted by accident in the Himalayas.

Haven't found anything lightweight that works better than Lubuntu out of the box (trialed Xubuntu, Ubuntu, Debian, ElementaryOS and some Arch flavours). Getting a dual boot up and running was easy.

My work is mainly fullstack, so I sit mostly between a terminal and a browser. An effective configuration with a tiling window manager is a must with this size of screen and being a TMUX/Vim user helps cut down the number of workspaces I need.

Couldn't recommend it more for travelling programmers!

codecurve··on Why Go solves so many problems for web developers
It feels like the author made the jump straight from PHP to Go without spending much time actually using Node or Ruby and he's subsequently shocked at how much better modern languages are when contrasted to PHP.

Many of these "solved problems" have also been solved with the other languages, albeit not always at the surface level. For Node specifically:

WebSockets -> SockJS, Socket/Engine.io

Concurrency -> Generator Functions

Testing -> import assert from 'assert' and npm test

Syntax -> Some great improvements with ES6 and solid styleguides (airbnb, standard) + eslint as an autoformatter

The major win here for Go is that as a new platform it was designed with simplicity in mind. These features are probably easier to pick up in Go than any of the alternatives, which is great. However, don't make the mistake of thinking that Go is the first language to solve these problems.

codecurve··on One Major Difference Between Clojure and Common Lisp
For all the gripes surrounding the lack of TCO on the JVM, Clojure really does provide a great set of tools to deal with iteration in a functional way. It's a rare thing when I need to fall back to using loop & recur.
codecurve··on Lisp in Your Language
Haha, that's a pretty clear case for them not being distracting!
codecurve··on Lisp in Your Language
Author here, would be interested to hear people's take on the addition of illustrations (illustration is being generous, I know). Do you find them distracting or do they help break up the text?
codecurve··on Node v4.0.0
You'll be able to achieve that behaviour when node also supports destructuring.

    import { readFile, writeFile } from 'fs';
    import { clone } from 'lodash';
← PreviousPage 2 of 3Next →