Hacker Newsnew | past | comments | ask | show | jobs | submit | andrewray's commentslogin

Taking shader programs (they have a main() functions), hacking up their source code / AST to turn the into modularized code packages, and then enabling composition of shaders by injecting the output of one module into another (essentially calling the main function of one shader in another). This enables arbitrary shader composition. One application is Photoshop-style stacking of shaders as layers, like https://shaderfrog.com/2/editor/cm6y90vai002mpaxio3zjhfvq

Or getting real freaky with it by composing many effects deep https://shaderfrog.com/2/editor/cm1s7w23w000apar738s9d1x0



It's been my experience, especially in the startup scene where business requirements change often, that `git blame` rarely shows you what you want. Files get renamed, moved, re-indented, etc, frequently.

I wrote a tutorial on a more effective (at least for me) solution to find the true author of a change: http://blog.andrewray.me/a-better-git-blame/


Nice tutorial, but aren't you aware that "git blame -w" ignores whitespace changes? git blame also always follows renames. git's rename detection isn't foolproof (if I edit and rename A.cpp to A-star.cpp at the same time as adding a new A.cpp file it won't detect it), however there are two more blame options for that: -C to follow lines copied between files, and -M to follow lines moved within a file.

Unfortunately, adding -M and -C will quite badly increases the time to compute the blame. Both take an adjustable parameter (min number of characters to match), but I found I actually had to reduce it to catch all the lines in an example of the A.cpp -> A-star.cpp move I did yesterday.


I would love to be able to use left and right to skip quickly through revisions when viewing a blame, do you know anything for that?


That's something I've wanted for a long time too.

tig (a curses-based git interface) fits the bill, though it can be quite confusing (too many keybindings). "tig blame -w <file>" to view a blame (-w to ignore whitespace), and then you can press , on a line to recompute the blame using the parent of that commit, while moving to the ancestor of that line (but tracking the line frequently doesn't work). And < to go back to the previous commit.

I remember that tortoisesvn was fairly nice for viewing blames, IIRC you can move through history inside it with some clicking around, and the tortoisegit interface appears to be largely the same: https://tortoisegit.org/docs/tortoisegit/tgit-dug-blame.html Windows only however.


I found http://1dan.org/git-blameall/ an incredibly useful tool for similar (not identical) purposes.


> It's been my experience, especially in the startup scene where business requirements change often, that `git blame` rarely shows you what you want. Files get renamed, moved, re-indented, etc, frequently.

Blame follows renames in most cases (unless you're doing something like creating a new file with the same name as the renamed one in the same commit), and you can use the -w flag to ignore whitespace changes.


Hi! I'm having trouble with both of these.

https://github.com/Microsoft/vscode/issues/95 https://github.com/Microsoft/vscode/issues/81

Also can you comment on why a jsconfig.json file is needed, as opposed to some in-editor setting, or reading from the config files the user already has installed, like an .eslintrc?


If your branch conflicts, rebase off master (the branch you're making a pull request to). Then it will merge cleanly. There's no practical downsides to having merge commits in master, but you should never (or rarely) see merge conflict resolution commits. You should be able to rebase to a mergeable state before merge.


If you use a pull request workflow then at the very least, you're forced to merge master into your branch (if there are conflicts) before merging your branch into master.

You should never (not even rarely) resolve merge conflicts on master...


You probably know this but just to be clear, to resolve conflicts on your pull request branch, you may merge master into your branch or rebase that branch on master; GitHub makes sense of either kind of resolution.


I've always heard good things about Vue from its users. I have to compare all Javascript frameworks to React, because to me React feels like the first framework that got it "right." The API of React is surprisingly thin. Looking at Vue templates, the syntax seems quite alien, halfway between Django and Angular:

    <th v-for="key in columns" @click="sortBy(key)" :class="{active: sortKey == key}">
And the API seems to needlessly separate HTML and Javascript, with some strange (to a newcomer) API calls:

    Vue.component('demo-grid', {     // moving away from JS classes
        template: '#grid-template',  // Why separate view code from view code?
        replace: true,               // what is this?
Has anyone heavily used React and Vue and have an argument for what this thicker API affords?


I've written large apps in both; interestingly, I've built the same app twice as well: once in Vue.js and once in React. I'm also in the process of building another very large front-end in Vue.js at the moment.

The big thing is that while I personally adore React, it does require ceremony to get stock-standard behaviour. We recently onboarded a new developer (a friend of mine), and teaching him React + Flux (Alt.js) was infinitely more difficult than teaching him Vue.js -- the "thicker" API (which is still an order of magnitude thinner than Angular or Ember) means you don't need to either reach out to other libraries to achieve tasks that you otherwise would need to in React.

Now, that's not a bad thing on React's side; it's a view-layer, not much more. That's okay, and a good thing! For building components rapidly in a regular "client -> designer -> cut-up -> development" workflow, Vue.js is streets ahead of React in terms of code required. But for building very large applications, React's smaller API means that you can guarantee behaviour, and things are consistent.

Basically, they are both brilliant libraries. I highly recommend both. React and Vue.js are similar in a lot of ways: they're both tiny little view layers that are component focused and have modern, ecosystem aware build tooling. They differ in that Vue.js is "classical" (though not really, it's far nicer than the older systems) MVVM which has been proven time and time again to be a good architectural choice, whereas React.js takes a more functional (as in programming) approach to the problem -- though I'd argue not far enough down the functional side, which is why I've been enjoying Cycle.js so much!

unless you get bitten by event pooling...


"and teaching him React + Flux (Alt.js) "

Can I ask what do you use for routing and if you have good results with that mix?


Interestingly, we're using our "own" router that I wrote in a fit of frustration; it's tiny, not particularly well documented and has the interesting design choice of handing the route matching on to the user of the library; give each <Route /> component a name and have your route matcher callback return that name and you're good to go.

The reason why I went down that route (pun intended) was that we built a rather large, isomorphic/universal web application that for SEO reasons had to act like a website vs a web app most of the time; until it started up the client side JS anyway. "react-router-component" was so close to what we wanted, but because it used React's somewhat undocumented "context" feature, it didn't play nicely with our Flux implementation at the time (Flummox).

For that reason, my tiny router came into being, and for some reason it keeps sticking around despite my best efforts...

https://github.com/studionone/react-isorouter

Ps. I just found out that the README links to non-existent documentation, I really should fix that...


Thanks.

I'm trying to find my way around flux but until now has been a little frustrating experience.

I wish something like Elm was mature enough.


> I wish something like Elm was mature enough.

So do I :)

If you're not 100% up on Flux, I recommend having a play with Hoverboard[0] -- it's a tiny implementation of the Flux architecture, with some interesting choices itself. It's a single function, too, which is pretty neat!

I've been using it to implement the "Flux Challenge" in combination with domChanger[1] instead of React: https://github.com/girvo/domchanger-hoverboard-flux-challeng...

And here's a partial TodoMVC implementation I wrote in Hoverboard and domChanger: https://github.com/studionone/todomvc-domchanger-hoverboard

---

[0] https://github.com/jesseskinner/hoverboard

[1] https://github.com/creationix/domchanger


Apologies for the formatting, I forgot about the rather greedy behaviour of italics on HN!


The `@click` and `:class` are in fact shorthands for `v-on:click` and `v-bind:class`. All directives start with `v-` by default. Shorthands are provided because these are two most often used directives.

Re moving away from JS classes: ES2015 class is inadequate due to the lack of static property initializers, and I don't want to force users to use stage 0 transforms. A Vue component definition is essentially an object of options, which is in fact easier than having to extend a base class. Also see https://medium.com/@dan_abramov/how-to-use-classes-and-sleep...

For the template, that's just because it's a one-pager demo and I don't want to use an inline string template. The proper experience is using single file Vue components: http://vuejs.org/guide/application.html#Single_File_Componen...

`replace: true` is a legacy option I forgot to remove in the demo :P


If I read the documentation correctly, you can also pass it a string to be used as template. If the string starts with a '#' it will act as a querySelector.

http://vuejs.org/api/#template


I love this feature. Putting html fragments in string literals in javascript seems pretty awkward to me.


What you are referring to is just syntactic sugar. @click is the same as v-on:click and :class is the same as v-bind:class. So you can write this line "less alien" like this:

  <th v-for="key in columns" v-on:click="sortBy(key)" v-bind:class="{active: sortKey == key}">


> I have to compare all Javascript frameworks to React, because to me React feels like the first framework that got it "right."

Have you looked at riot.js?

[r] http://riotjs.com/


If you're on a Mac, you can have some fun with voices (plenty designed for multiple languages):

    say -v ?
Or just run this script to pass hours of time in joy and terror: https://gist.github.com/DelvarWorld/3f700aac8d7972b053f0


Cars seem fundamentally different than his other examples: Spacecraft, underwater vehicles, and airplanes. The importance difference is cars have a clear, visual grid of where they can travel and where they cannot travel. Painted lines on the road and navigational signs provide a construct of the environment around them.

Maybe the closest comparison is subway / metro rails. There are already many fully automated subway systems: https://en.wikipedia.org/wiki/List_of_automated_urban_metro_...


There are still some elements of uncertainty in car driving. For e.g. driverless cars are confused by cyclist doing track stand[1]. Hopefully with enough data driverless car could overcome these difficulties.

[1] http://road.cc/content/news/162468-cyclist-doing-trackstand-...


Interesting story. There's a later article [1] that describes the problems that the Google car has with assertiveness at junctions.

[1]: http://www.roboticstrends.com/article/a_cyclists_encounter_w...


The hard part of self-driving cars is not staying within the painted lines of the road, the hard part is avoiding other valuable things like cars, trucks, bikes, people, wildlife, etc. There is no reliable visual grid for those things.

Subways handle this problem by being given dedicated underground tunnels which exclude all those things. And even subways hit people sometimes when they fall onto the tracks.


> difference is cars have a clear, visual grid of where they can travel and where they cannot travel.

Visual grid for people to look at. All those cues and signs were not designed to be read and processed by robots. And there are crazy pedestrians, crazy drivers, maybe cattle crossing the street, an accident, ice, fog, ice and fog and cattle, unpaved roads, etc.

I would think an airplane's environment when in the air seems more predictable and stable, than an environment for car on the streets. Same thing for underwater vehicles. There might be crazy pranksters playing games with the vehicle 100 feet under water, but probably not a high probability.


> And there are crazy pedestrians, crazy drivers, maybe cattle crossing the street, an accident, ice, fog, ice and fog and cattle, unpaved roads, etc.

All of which people often don't do that well on themselves.

> All those cues and signs were not designed to be read and processed by robots

No, but they were designed to be clear and quickly identifiable by humans with vague glances. We're not asking for them to identify a subtly sarcastic remark, signs are more of the "BIG RED CIRCLE WITH STRAIGHT WHITE LINE" variety.

> I would think an airplane's environment when in the air seems more predictable and stable, than an environment for car on the streets

Possibly, but the risks are significantly higher. If something unexpected happens you can't just come to a halt and put your warning lights on 30,000 feet in the air.

> Same thing for underwater vehicles

I disagree on this one, the environment is going to be largely unknown and more importantly for exploration you aren't just saying "go here". When I drive somewhere, many of the roads will have been driven over thousands of times the same day.


In Northern climes, the painted lines on the road are often covered by snow.


This seems to take the declarative nature of SVG and make it more imperative, like HTML5 Canvas, even though it ironically uses a virtual DOM implementation under the hood. For my React projects I chose SVG over canvas because I could write my layout declaratively, and avoided imperative manipulation libraries. How do you modify existing SVG shapes with this library?


It's a shame React Art isn't mentioned more (https://github.com/reactjs/react-art). I'm pretty happy with the results from it, and it's a bonus that it works on iOS as well as drawing to Canvas, SVG, or VML on the web.

It doesn't support some of the more advanced features of SVG, but that's the trade-off for wider support.


Remove the ?currentPage=all from the URL to get the non-broken version of the link.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: