Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
isntitvacant
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
isntitvacant
14y ago
In both examples, the function is only allocated once, no matter how it's instantiated. Where you have to be careful is if you have a function that's being called repeatedly and it contains a function instantiation -- that function will be
2.
▲
by
isntitvacant
14y ago
In this case, it's not language lawyering. All JavaScript environments "do the right thing" with regards to ASI -- it works in all target environments as of the present day. JSMin is not a target environment, it is a minifier that happens t
3.
▲
by
isntitvacant
15y ago
I'm increasingly a fan of local named functions in JS, vs. pulling callbacks entirely out of scope. An example: function compile(filename, ready) { return fs.readFile(filename, make_fn) function make_fn(err, data) {
4.
▲
by
isntitvacant
15y ago
Regarding the gzip-js implementation, it appears to rely on rawinflate.js/rawdeflate.js, which I've never been able to find suitable license information on (and, in fact, contain a copyright assigned to the original author in a comment near
5.
▲
by
isntitvacant
15y ago
(I assume) the reason that node chose to go with a single global object (which is optional[0]) is that JS gets a bit hinky when dealing with multiple contexts: e.g., an array returned from a function defined in a different context will not
6.
▲
by
isntitvacant
15y ago
Thanks -- yeah, at the moment it's tightly bound to node's 'fs' module, though I was planning on abstracting it so you could use 'FileData' in modern browsers. I've got the three ODB's implemented (and, I think, most of the types within) --
7.
▲
by
isntitvacant
15y ago
this looks really cool. i was actually working along the same lines ( https://github.com/chrisdickinson/tempisfugit ) to get a pure JS git implementation, though now I'm a little disconcerted since your project looks so fully featured :) On
8.
▲
by
isntitvacant
15y ago
Yes and no -- it's not absolutely necessary; I could've written it similarly without turning the callback-accepting functions into emitter-returning functions. It would have felt gross to do so, though. The downside I see with using straigh
9.
▲
by
isntitvacant
15y ago
re: cutting down on callback nesting / spaghetti code. It can be hard to avoid; and having the community put together a PEP-8 style "best practices" to avoid creating nested code is one of my fondest dreams. That said, I've written my fair
10.
▲
Not Your Father's JavaScript - Better built-in methods for common actions
(neversaw.us)
9 points
by
isntitvacant
16y ago
|
0 comments
11.
▲
by
isntitvacant
16y ago
something like this: var session = require('session'), models = require('models'), template = require('template'); function main(request,response){ session.start( models.getEntries.bind(models, template.
12.
▲
by
isntitvacant
16y ago
Hi -- this is chrisdickinson. One of Wilson's goals is to be comfortable for Djangonauts who, for whatever reason, need to write Node.js code. To that end, the ORM, view layer, and template system are similar to Django to ease use in that p
13.
▲
by
isntitvacant
16y ago
as an admonition: this project is very much a work in progress right now (at the moment, I'm moving the ORM into Wilson proper) so the docs are a little out of date. I have a separate github repository that serves as a wilson example: http
14.
▲
Weekend project: Node.js Python binding (plus a walkthrough)
(neversaw.us)
8 points
by
isntitvacant
16y ago
|
0 comments