// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
// ******************************************************************* | |
// ATTENTION | |
// This gist is now an npm module | |
// The API of some functions is altered slightly. | |
// All future work will happen in the repo. | |
// | |
// https://gitlab.com/rhythnic/vuex-intern | |
// ******************************************************************* | |
// ******************************************************************* |
Using nginx version: nginx/1.6.2 and Laravel 5 | |
In the controller: | |
use Symfony\Component\HttpFoundation\StreamedResponse; | |
- - - - - - Some method - - - - - - - - - | |
$response = new StreamedResponse(); | |
$response->headers->set('Content-Type', 'text/event-stream'); | |
$response->headers->set('Cache-Control', 'no-cache'); | |
$response->setCallback( | |
function() { |
A "choose your own adventure" story
JavaScript is has both object-oriented and functional heritage, thanks to its two parents: Scheme and Self.
It provides first class functions and makes it simple to compose these function objects into bundles of awesome. Even though I'm an OO "true believer" at heart, I find myself composing my code using functional concepts, and use the OO approach where there's a clear benefit or where I feel that it's the best way to communicate the interface.
Object-oriented software design is by no means the only way to do software design, but it's been an immensely successful model for a very long time now, and provides a clear and well-understood mental model for thinking and communicating about software. Lots of good ideas like encapsulation, delegation, traits and composition fit well into OO design.
using System; | |
using System.Diagnostics; | |
using System.Collections.Generic; | |
using System.Threading; | |
namespace bettercraft | |
{ | |