.Jack Way no other extension store (mozilla, apple, opera) demands payment, or requires it for verification. Also, Mozilla offers a far superior extension upload experience. Google has no excuse :)
.Jack Way no other extension store (mozilla, apple, opera) demands payment, or requires it for verification. Also, Mozilla offers a far superior extension upload experience. Google has no excuse :)
And the #js lesson of the day is: bean.fire(el, 'click')
doesn’t work in Firefox Nightly, but turns out it’s unnecessary, because HTMLElement.click()
does exactly the same thing and already works cross-browser. Always use the browser-native APIs if you can.
I get a little annoyed at #python every now and again (grr package management) but then I come across things like nested tuple unpacking which are just so lovely they make up for it:
for i, (key, value) in enumerate(list_of_tuples):
print i, key, value
I just faked having a task queue for #taproot #indieweb note posting tasks using Symfony HttpKernel::terminate()
and it was the easiest thing ever.
Instances or subclasses of HttpKernel
have a terminate($request, $response)
method which, if called in the front controller after $response->send();
triggers a kernel.terminate
event on the app’s event dispatcher. Listeners attached to this event carry out their work after the content has been sent to the client, making it the perfect place to put time-consuming things like POSSE and webmention sending.
Once you’ve created your new content and it’s ready to be sent to the client, create a new closure which carries out all the the time consuming stuff and attach it as a listener to your event dispatcher, like this:
$dispatcher->addListener('kernel.terminate', function() use ($note) {
$note = sendPosse($note);
sendWebmentions($note);
$note->save();
}
Then, provided you’re calling $kernel->terminate($req, $res);
in index.php, your callback will get executed after the response has been sent to the client.
If you’re not using HttpKernel and HttpFoundation, the exact same behaviour can of course be carried out in pure PHP — just let the client know you’ve finished sending content and execute code after that. Check out these resources to learn more about how to do this:
fastcgi_finish_request()
flush()
HttpFoundation\Request::send()
as a sample implementationFurther ideas: if the time consuming tasks alter the content which will be shown in any way, set a header or something to let the client side know that async stuff is happening. It could then re-fetch the content after a few seconds and update it.
Sure, this isn’t as elegant as a message queue. But as I showed, it’s super easy and portable, requiring the addition of three or four lines of code.
Having fun with tour.golang.org/#35
MDN says FF has “implemented” the SVG text module, then goes on to list 13 presentation attributes which “don’t work”. How exactly does that count as implementing the module? Grr. This is why @supports
is doomed.
Are there any languages with datatypes with built in version control? Would be pretty great for debugging.
Just in case anyone was wondering, the “HA HA HA SOUP” bookmark in those gifs is this bookmarklet:
document.createTreeWalker
is actually pretty great.
Musing on why we only turn to natural language for defining the behaviour of out applications instead of the business logic itself.
Rough ideas: gist.github.com/barnabywalters/6188240
git pull origin hamster
For the tenth time today.
@briansuda just playing around with SimpleCV, looks like working with Kinect depth data is extremely easy! tutorial.simplecv.org/en/latest/examples/kinect.html
Loving Django’s prefetch/select_related
— that, along with a few small changes, reduced a task which was taking > 500,000 queries to 4558
I’m thinking the time might have come to write a wrapper around #php DOMDocument which actually makes it usable. Thoughts:
querySelector
and querySelectorAll
are implemented for both the document and individual elements via Symfony XPath → CSS converter and relative XPath queriesinnerText
, innerHTML
for consistencyWhen dealing with character encoding issues I repeatedly get this feeling that we need to throw away computing and programming and redesign it all in a way which prevents stupid, hard-to-debug problems from happening live in trees and eat pita bread all day
Just pushed latest #taproot changes: using htmlpurifier.org to remove any nasties in reply contexts and comments, hopefully with upcoming php-mf2 changes that’ll allow limited HTML comments!
Also using brand new php-mf2-cleaner to parse said reply contexts and comments, find authors, etc. Check it out if you deal with #microformats 2 at all in PHP.
Trying out note posting on a fresh install of the new #taproot
#django tip: if you come across weird inconsistencies between apps when trying to serve static files in dev, run with runserver --insecure
even if you have DEBUG=True
@thatemil I’ve always considered style guides/pattern libraries to be unit tests for HTML+CSS, and you could automate them with JS if they get too unwieldy.