by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
G. Gibson
@mistergibson
Loves me some SVG
Very handy
Jamie Gaskins
@jgaskins
I hadn't even thought of it until @jegt asked about it for ArkivDigital. Turned out to be easy(ish) and I've ended up using it several times since then. The API for it turned out way friendlier than I expected it would be.
G. Gibson
@mistergibson
surprised yourself eh?
Nice when that happens
Jamie Gaskins
@jgaskins
lol A big part of it is that the SVG API was similar enough to the DOM API that Clearwater could reuse a lot of the same logic.
G. Gibson
@mistergibson
I suspect the same will be the case with WebGL - its all html/xml-ish I think
Jamie Gaskins
@jgaskins
There were some special cases, like how SVG attributes are sometimes kebab-case, sometimes camelCased, sometimes just compound words, but otherwise it was pretty reasonable.
G. Gibson
@mistergibson
I see
Jamie Gaskins
@jgaskins
Cool, I'll have a look at WebGL after I get these PRs up. :-)
G. Gibson
@mistergibson
Opal-Browser has a 'canvas' .rb file - dunno much about how they handle things though - might be a source of inspiration for you.
Jamie Gaskins
@jgaskins
They do, but their code is quite a bit heavier. Bowser tries to be a bit more streamlined by avoiding explicit APIs when delegating to the native ones with method_missing will do what we need. Since the Canvas API is almost completely implemented with method calls that receive numbers, everything I've tried from MDN just worked. :-) The only thing I found that hasn't worked is context.stroke(path). Using it without the path works just fine, though.
G. Gibson
@mistergibson
ok
Jamie Gaskins
@jgaskins
clearwater-rb/bowser#24
Jamie Gaskins
@jgaskins
clearwater-rb/clearwater#76
Those are the Canvas PRs. Should be able to include them in your app with this in your Gemfile:
gem 'bowser', git: 'https://github.com/clearwater-rb/bowser.git', branch: 'canvas-support'
gem 'clearwater', git: 'https://github.com/clearwater-rb/clearwater.git', branch: 'canvas-support'
G. Gibson
@mistergibson
cool
Jamie Gaskins
@jgaskins
Feel free to comment on them if you find something useful that doesn't work. I'm too unfamiliar with Canvas to know what parts of it are worth including. :-)
G. Gibson
@mistergibson
will do
Jamie Gaskins
@jgaskins
I just realized Clearwater Playground (https://clearwater-rb-playground.herokuapp.com) was down. It uses Neo4j as a data store and I didn't set up the Neo4j SSL certs correctly. They were automatically updated when they expired, but symlinks were pointing to the old versions, which caused an SSL validation error while connecting to the DB.
It's back up now, though. :+1:
Forrest Chang
@fkchang
@jgaskins do tell on Neo4J as a datastore -- wondering about graph DB as store for a playground
Jamie Gaskins
@jgaskins
@fkchang I've given talks on it a few times. Here are the slides from the first place I gave it: https://s3.amazonaws.com/jgaskins/uploads/Neo4j.pdf
I didn't talk about it from the perspective of Ruby, more from a data-centric perspective since that's arguably the more important part, but the neo4j gem is pretty great. It's heavily inspired by ActiveRecord, but handles the graph properties really nicely and I love its associations API. I don't think it supports has_many :through, but N+1 queries are a lot less common.
Jamie Gaskins
@jgaskins
I used it for Clearwater Playground so that when I add support for forking a playground, I would be able to track all of the forks and their forks and so on of your app, as well as see the entire lineage all the way to the root.
It's a feature we had at my old job for report data, but we used Postgres and it was painful to do. CTEs are hard, I don't understand them, and they're slow on Postgres.
Actually, I believe the author of the neo4j gem gave a lightning talk at RubyConf last year.
Jamie Gaskins
@jgaskins
Click the link, though. The embed doesn't start at the right time.
I only realized he gave the talk because he was directly after a friend of mine.
Forrest Chang
@fkchang
@jgaskins good preso been a number of years since I last looked at Neo4J
Forrest Chang
@fkchang
@jgaskins did you know about http://www.susi.se/bluesky/ ?
Jamie Gaskins
@jgaskins
Indeed :-) I saw it when GitHub released their dependency graph feature. I wouldn't doubt it's an extraction of some of the patterns they used for https://arkivdigital.se
@fkchang But I didn't realize there was a full-on website for it. Thanks for the heads up there!
Jamie Gaskins
@jgaskins
I just published clearwater-virtual_list, a gem for rendering large lists without putting the entire thing in the DOM.
Colin Gunn
@balmoral
@jgaskins trying to find your code which eliminated uncalled javscript methods - having another go at getting it going.
It requires either Opal 0.11 (I think) or at least has to have opal/opal@07610e0 applied.
Jamie Gaskins
@jgaskins
And it needs to be run against minified code (I tested it against code run through Uglify)
Colin Gunn
@balmoral
@jgaskins thanks
Jamie Gaskins
@jgaskins
:+1:
Jamie Gaskins
@jgaskins
Built a Clearwater component the other day that renders promises, mostly inspired by React Suspense. It uses method chaining to declare what to render up front, at various time delays, and on resolution/rejection of the promise: https://clearwater-rb-playground.herokuapp.com/playgrounds/598a3a3d-b0f7-472d-9f88-aa3c1a1b9ae2
I don't use a lot of promises within components typically, but if I need to, I can't imagine it getting any nicer than this. I certainly like it more than what I've seen of React Suspense.
James Robey
@foucist
is http://jgaskins.org/blog/2016/02/28/turbolinks-vs-the-virtual-dom still a fair article? 8ms for clearwater seems too good to be true
Jamie Gaskins
@jgaskins
@foucist That article is definitely still fair. :-) I just checked the Clearwater app linked in the article and it actually took 6ms from the click event to the final paint.
Screen Shot 2018-09-09 at 2.30.10 AM.png
That's less than the 8ms I measured for that article, but I'm on a newer machine than I was when that article was written, and less than 2ms of that 6ms was spent in JS. The rest was layout/paint. With some reasonable render caching, even large vDOMs can be blazing fast.
Jamie Gaskins
@jgaskins
My favorite Clearwater performance story is from a real-time order dashboard I developed with Clearwater while I was at Groupon. We were getting hammered by data over websockets and even with about 10-15k nodes in the DOM (nearly all of which were managed by the Clearwater app) and we were still hitting 30-60fps renders.
Jamie Gaskins
@jgaskins
Experimenting with building a Clearwater version of React Suspense. Was able to knock it out in 99 lines of Ruby. I'll post it soon.
Forrest Chang
@fkchang
@jgaskins saw the tweets, looks cool, look forward to it