Skip to content

Instantly share code, notes, and snippets.

View ryanstockau's full-sized avatar

Ryan Stock ryanstockau

View GitHub Profile
@rhythnic
rhythnic / vuex-reusable-functions.js
Last active October 21, 2022 07:41
Reusable Vuex Functions
// *******************************************************************
// 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
// *******************************************************************
// *******************************************************************
@jackmott
jackmott / FasterGame.cs
Last active August 21, 2020 18:17
Faster CSharp Game
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Threading;
namespace bettercraft
{
@lgalaz
lgalaz / gist:aec80abd40350161ff63
Last active July 12, 2022 02:18
Server sent events with Laravel
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() {
@simonexmachina
simonexmachina / post.md
Created May 8, 2014 23:17
JavaScript and Object Models

JavaScript and Object Models

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.

@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// 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'];