1,260 karma · joined Nov 2, 2009 (17y ago) · 479 submissions
comment 10y ago · link · parent
comment 10y ago · link · parent
Mechanic: "Why won't you answer me?"
Terrorist appears next to him: "Because it's just a car, you freak."
comment 10y ago · link · parent
comment 11y ago · link · parent
comment 11y ago · link · parent
comment 11y ago · link · parent
* basic HTML markup (headlines, paragraphs, lists...)
* HTML tables
* images (data:// URIs are good for handling pasted images) and an image/file browser, complete with some image processing that rejects or shrinks down giant images without ruining the image quality, because people will upload giant JPEGs straight from their phone if you let them (naturally, file uploads come with their own cans of worms like server security, disk space, file permissions, growing backups, etc.)
* black magic to cope with Word's markup
Don't forget to make sure that the end result looks consistent with the rest of the site without the users having to manually set the font family/size on all their text... and that the editors can't turn off the RTE and post raw HTML with malicious intent... and a million other things.
comment 11y ago · link · parent
There are still cases where you'll need to sprinkle <any>. For example:
var state = { foo: 1 };
if(something) {
state.bar = 2;
}
is valid JS, but the TS compiler will complain that `state` does not have a member named `bar`.comment 11y ago · link · parent
comment 11y ago · link · parent
A man is walking down the street carrying a 12-roll pack of toilet paper. People surround him, all excited: "Where'd you get that?" The man answers, "I just got it back from the dry cleaner's!"
comment 11y ago · link · parent
Tangent: speaking from personal experience, sifting through an existing foreign code base is a really exciting task for some people, figuring out what makes it tick and how the pieces fit together can be fun. Granted, I was reverse-engineering a closed-source product, not reading its actual source, but that was even more fun :D Come to think of it, the tool I used for that, IDA Pro, has some interesting features that IDEs don't, such as graphical representations of function call graphs [1] and function basic blocks [2]. It would be interesting to see what a creative person could do by integrating those into a regular IDE.
[1] http://scratchpad.wikia.com/wiki/Reverse_Engineering_Mentori...
[2] https://www.hex-rays.com/products/ida/tech/graphing.shtml
comment 11y ago · link · parent
comment 11y ago · link · parent
[1] http://www.tocker.ca/2014/01/14/making-strict-sql_mode-the-d...
comment 11y ago · link · parent
Without an in-browser persistent database (we used WebSQL, with all the future risks), it would require some interesting workarounds (can you serialize multiple megabytes to local storage? how long will it take? will it rollback from a fault correctly?) or Phonegap type solutions.
comment 11y ago · link · parent
That's still true, as I recall. To avoid this nonsense, you need to change the sql_mode - either globally in the server config, or only within your session by issuing an SQL query.
Documentation: https://dev.mysql.com/doc/refman/5.6/en/sql-mode.html#sqlmod...
comment 11y ago · link · parent
comment 11y ago · link · parent
The good parts :
* The type system serves as a great safety net and prevents a whole class of bugs.
* Intellisense is far smarter than you would get from JavaScript (no more silly IDEs with both jQuery's .append() and DOM's .appendChild() in the same intellisense suggestion). This enables refactorings and intelligent assistance such as Find All References, which is much more brittle in plain JS.
* Classes are much more convenient and readable than old-school inheritance solutions. Those old solutions were also a huge problem for JS intellisense.
* AMD Modules paired with Require.js are much more centralized than "add these fifty script tags to the HTML document, in the right order". That's more due to AMD, but TypeScript adds some nice syntax sugar on top of that.
* Arrow functions. No more `var that = this` to keep callbacks working.
* Generics, function overloads, etc. - depends on the things you use in your code. If most of your viewmodel properties are Knockout Observables, generics are a life saver. If you're chaining Promises, again, generics can cover their return/param types. Function overloads come in handy if you have factories building objects based on string parameters (example: document.createElement() returns different classes based on the name passed in). And so on.
The bad parts :
* New language to learn. And it keeps evolving.
* Requires an additional build step. There's a large amount of small projects without any build process out there - integrating TS into such a project can be difficult and open a new can of worms related more to the build process than TS (e.g. "do you commit the generated JS and sourcemaps, or provision a build server to package them?"). Of course, if you're already using Grunt/Ant/Phing/whatever else, this is not a big problem. (You should be using a build process at least to aggregate your JS into one blob, if nothing else.)
* Definitions for third-party libraries. DefinitelyTyped helps a lot here, but there are still things that it doesn't cover, and it can be time-consuming to keep a definition file in sync with a library as the library updates.
* IDE support. After using PHPStorm/IntelliJ and Visual Studio Express/Community, Visual Studio wins hands down. IntelliJ's support was quite disappointing and glitchy, especially its lack of intellisense. Visual Studio Code, Community and Express are all free, but the latter two are quite bulky and running them alongside a different IDE can be slow.
* Debugging can be a bit challenging due to sourcemaps, depending on the target browser. I prefer to disable sourcemaps and debug the generated JS directly, but that requires some mental juggling and is not everyone's cup of tea.
comment 11y ago · link · parent
For example: An article was linked on the HN frontpage a couple days ago about how CP/M reserved names (COM1, etc) still live on in ASP.NET MVC these days. https://news.ycombinator.com/item?id=9871014