HNHacker News
TopNewBestAskShowJobs

evanrmurphy

605 karma · joined February 24, 2010

submissionscomments
evanrmurphy··on Ask HN: Anyone have a really smart way to organize css?
Not a joke, though I realize it's an unpopular view.

I also had trouble phrasing the idea in a way that didn't sound stupid.

evanrmurphy··on Ask HN: Anyone have a really smart way to organize css?
The problem is that as a site grows, it's common for things that were once unique to become multiple.

Also, if you just resolve to always use classes instead of ids, then you can eliminate the cognitive overhead that comes with every new selector of, "Should this be a class or an id?".

evanrmurphy··on Ask HN: Anyone have a really smart way to organize css?
Sometimes it's better to inline a style than to put it in a separate file.

I think when you find yourself writing nested selectors that are heavily dependent on the HTML structure, it's an indication that your code could be less fragile if you just used the HTML style attribute instead.

evanrmurphy··on Ask HN: Anyone have a really smart way to organize css?
Use tables for layout instead of CSS. Then your CSS will be more concise (essentially reduced to a theme) and less confusing (because CSS layout properties like float and position tend to cause the most confusion).

Edit: Rephrased to try and better express the idea.

evanrmurphy··on Ask HN: Anyone have a really smart way to organize css?
"I agree about IDs for JavaScript though."

Would you mind elaborating on the JavaScript point? Is it for convenience with document.getElementById or something?

Using jQuery, I tend to prefer class selectors the same as in my CSS.

evanrmurphy··on We should stop running away from radiation
Ah, I see. I was thinking more about the general concept of safety than this specific situation. I see what you mean.
evanrmurphy··on We should stop running away from radiation
What do you mean by horrible? I think it makes sense to be concerned about anything you're subjected to that you're not sure is safe.
evanrmurphy··on Translation from Haskell to JavaScript (Introduction to monads)
I know lisp better than Haskell, and so I'm more familiar with macros than with monads. From what you describe, it seems to me that the use cases for monads and macros have some overlap.

Take the OP's example for the Writer monad, in which several functions needed to return a debug string "<function name> was called" in addition to their main return value. If I had these two functions+:

  (def sine (x)
    [(Math.sin x) "sine was called"])

  (def cube (x)
    [(* x x x) "cube was called"])
I might write a macro like the following (rather than a monad) to abstract away their common pattern:

  (mac defWriter (name parms body...)
    `(def ,name ,parms
       [,@body (+ ,name " was called.")]))
And then each function's definition could be written more concisely:

  (defWriter sine (x)
    (Math.sin x))

  (defWriter cube (x)
    (* x x x))
---

+ Forgive me for indulging in the syntactic sugar from my own lisp->javascript project in these examples, but since we're dealing in JavaScript I couldn't resist. https://github.com/evanrmurphy/lava-script

evanrmurphy··on Translation from Haskell to JavaScript (Introduction to monads)
Hmm! That's funny, I thought I was "getting" monads better after reading this article (as someone who doesn't already have a firm grasp of monads, of course).

You see, I already sensed that monads:

- were a way that you could sort of simulate side effects using pure functions

- had to do with the type signatures of functions

What I gleaned from the article is that monads:

- have to do with making functions composable

- work by way of the abstractions bind and unit in order to make type signatures match

Did the article harm my (lack of) understanding of monads?

evanrmurphy··on I Hate CSS
> HTML content can be shared between desktop and mobile devices with just a stylesheet change.

Have you been able to pull this off in most cases?

In my experience, the mobile version of a site requires changes to the HTML, such as turning links into buttons and removing content.

evanrmurphy··on I Hate CSS
Please demonstrate it then. I hear many more people saying CSS isn't difficult than showing it.

To be sure, I'm talking about CSS for layout here, not styling. I find CSS for styling to be relatively straightforward.

evanrmurphy··on I Hate CSS
Can you gives some examples of requirements that must be abandoned?
evanrmurphy··on I Hate CSS
Thank you, this look like a good resource. :)

However, a book is a very different investment from "maybe ten minutes of reading a how to guide".

evanrmurphy··on I Hate CSS
> takes like maybe ten minutes of reading a how to guide as to how to figure out how to do it with real css.

Sorry but I'm skeptical.

If you could prove this by sharing a paragraph or two (should be all it takes, right?) teaching how to use CSS to build reliable layouts I would be grateful.

evanrmurphy··on Which websites dropped the most in the latest Google algorithm change?
They probably have Google Alerts set up on eHow search terms, or something like that.
evanrmurphy··on Why I absolutely love java
Yes, you're exactly right.

However, since Java was not intended to be a scripting language, then it should never have monopolized the material of introductory programming classes like it did. I consider Java to be a very ungentle introduction to programming when compared with Python, Ruby or Scheme.

evanrmurphy··on Who else is hacking a project instead of watching the Super Bowl?
Could have to do with the presentation. I'm interested in better understanding the complexity of the game, but all the hype and advertising can be a turn-off.
evanrmurphy··on How Lisp macros differ from static code-generation and metaprogramming
In dialects that support fexprs such as Kernel, PicoLisp and Eight, you get something almost like first-class macros. Macros (or fexprs, rather) are then even more powerful, because they can be passed around as arguments to functions or even to other fexprs.

A key tradeoff is that they must be expanded at run-time, and in doing so they incur a performance penalty that doesn't exist with compile-time macros.

evanrmurphy··on Git-powered wikis improved - GitHub
For a solo project though, the simplicity is really refreshing.
evanrmurphy··on Learning Advanced JavaScript
Can you give some other examples of Crockford's advice that you'd disregard or how the Closure Compiler affects the way you write JavaScript?
evanrmurphy··on Literate Programming (and why Docco isn't enough)
That was also the most relevant snippet I found while searching. :) Unfortunately, I couldn't quite figure out if it was a confirmation of my claim or a rebuttal. Would you mind clarifying?
evanrmurphy··on Literate Programming (and why Docco isn't enough)
> My point is just that in any modern language at a reasonable level of granularity, the order in which you write the code is 99% independent from the order in which you execute it.

I believe that in most dialects of lisp, macros must be defined before they can be called. [citation needed]

This is not to undermine your point, which I think is valid. Macros would just be an interesting exception because they're arguably the feature of lisp, and surely make up > 1% usage for that family of programming languages.

evanrmurphy··on Literate Programming (and why Docco isn't enough)
One idea about design I take from pg is that it's difficult to "even talk about good or bad design except with reference to some intended user." [1]

Now, I'm relatively new to literate programming, and perhaps the answer to my question(s) will be obvious to someone more experienced with it. What I wonder though every time I read about it is, who is the intended audience of all this extensive documentation? More specifically, how much knowledge of the programming language and problem space do we presume that the reader has?

There is something elegant about presuming the audience has expertise in both areas. That way you only have to worry about documenting one thing, the program, rather than three things: the program, the programming language and the problem space. Readers lacking sufficient understanding of the lang or problem space can refer to the more robust documentation about either one individually to get themselves up to speed. But I'm not sure Docco users are taking this approach.

---

[1] http://www.paulgraham.com/desres.html

evanrmurphy··on How the neo-medieval 21st century will be more like the 12th century
My US-made computer keyboard: http://pckeyboards.stores.yahoo.net/cus101usenon.html.

On second thought, this isn't a major product at all. It's actually quite obscure. I just like it a lot.

evanrmurphy··on Starting with Lisp: A collection of beginner pointers
> I'm not sure how my brain would react to non-delimited forms (ie, the implicit pairs).

You probably wouldn't like it. ;) Seriously though, I think what we're used to plays a tremendous role in our preference here.

> I also don't know how Emacs handles the indentation for these

For Arc, anyway, the indentation algorithm is constantly making mistakes. I always hesitate to auto-indent a region because I know I'll have to go through and manually fix things. But I'm not sure this is the language's fault - the Emacs mode probably just needs to be smarter.

evanrmurphy··on Starting with Lisp: A collection of beginner pointers
Thanks for your straight-up and instructive comment.

> And indeed, there is a point in the learning curve where you get confused about the proper numbers of parentheses for certain kinds of expressions (so-called 'special forms'). [...] In my experience, what happens is that as you become familiar with these 'special forms', you learn to recognize the visual patterns of indentation and parentheses that are particular to each of these expressions.

Yes. This seemingly mundane topic actually interests me a great deal.

One thing that I appreciate about Arc, despite all of the language's shortcomings today (few libraries, no module system, tiny community, scarce documentation, etc.), is that its designer has taken great care to minimize the number of parentheses. The core language almost as a rule doesn't employ parentheses unless absolutely necessary, and it's nice to have a guiding heuristic like this while you're learning because it allows you to internalize the special forms more quickly.

evanrmurphy··on Which Lisp Variant for Web Dev?
> Clojure if you need to build anything serious.

Could you please link to some web apps built in Clojure? I really wanted to use Clojure for web development, but because I couldn't find many existing projects, I kind of concluded that if you really need to build anything serious you should be using Rails.

evanrmurphy··on Which Lisp Variant for Web Dev?
As JavaScript becomes increasingly ubiquitious thanks to budding frameworks like node.js, the lisp->javascript compilers start to look more interesting. Parenscript [1], Scriptjure [2] and Scheme2Js [3] are the respective projects for Common Lisp, Clojure and Scheme, and they're all relatively mature.

More recently, Jacob Rothstein started Sibilant [4], which I've been collaborating on [5]. The main difference in approach is that we're trying to design a new lisp dialect optimized for the task of writing JavaScript, rather than compiling from an existing lisp dialect that wasn't designed with this purpose in mind. Since it's such a young project, I wouldn't recommend it for production environments now, but you should keep an eye on it if you're interested in this sort of thing.

---

[1] http://common-lisp.net/project/parenscript/

[2] http://www-sop.inria.fr/indes/scheme2js/

[3] https://github.com/arohner/scriptjure

[4] https://github.com/jbr/sibilant

[5] https://github.com/evanrmurphy/sibilant

evanrmurphy··on What a 16 year old thinks about how Facebook is changing our society.
There's a huge difference between knowing that something is true and wanting to be reminded about it constantly in graphic detail.
evanrmurphy··on Introducing the New Profile
> Allowing you to change back to your old profile at will wouldn't be a very feasible move, I'd imagine.

I agree. It would be a real headache. That's why I would have been really impressed if they did it. Or rather, I would have been really impressed if they found a way to do it that wasn't a headache. :)

← PreviousPage 3 of 8Next →