... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
| // This code is to be used with https://turbo.hotwire.dev. By default Turbo keeps visited pages in its cache | |
| // so that when you visit one of those pages again, Turbo will fetch the copy from cache first and present that to the user, then | |
| // it will fetch the updated page from the server and replace the preview. This makes for a much more responsive navigation | |
| // between pages. We can improve this further with the code in this file. It enables automatic prefetching of a page when you | |
| // hover with the mouse on a link or touch it on a mobile device. There is a delay between the mouseover event and the click | |
| // event, so with this trick the page is already being fetched before the click happens, speeding up also the first | |
| // view of a page not yet in cache. When the page has been prefetched it is then added to Turbo's cache so it's available for | |
| // the next visit during the same session. Turbo's default behavior plus this trick make for much more responsive UIs (non SPA). | |
| Spree API Server Needs | |
| - Easy Setup & Deployment (Dokku) | |
| - New Relic | |
| - Error Monitoring (Raven) | |
| - Performance Monitoring (Skylight) | |
| - Logging (Loggly or Logentries?) | |
| - SSL (Dokku handles this) | |
| - Database Backups (http://donpottinger.net/blog/2014/11/22/bye-bye-heroku-hello-dokku-part-2.html (See Clockwork section)) | |
| - Caching (Memcached + Dalli) | |
| - Worker (Sidekiq) |
| import serial | |
| from time import sleep, strftime | |
| from datetime import datetime | |
| import commands | |
| ser = serial.Serial(port='/dev/ttyAMA0', baudrate=9600) | |
| cls = bytearray([254, 1]) | |
| ip_addr = commands.getoutput("hostname -I").split(" ")[0] | |
| def clearscreen(): | |
| ser.write(cls) # clear and reset screen | |
| sleep(0.01) |
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
| serpIQ.factory('UserAccount', ['$resource', '$timeout', function($resource, $timeout) { | |
| var userResource = $resource('/users/account', {}, {}); | |
| var accountInfo = {}; | |
| (function pollStatus() { | |
| userResource.get({}, function(response){ | |
| accountInfo = { | |
| plan: response.plan, |