This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* MiniMap.js - MiniMap for the game Adventure.Land | |
* | |
* Features: | |
* Event emitter | |
* Drag to reposition | |
* Numpad plus/minus to zoom | |
* Toggle visibility to show or hide | |
* Left click to interact with markers, right click to smart move | |
* Easily extensible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Example cache class that uses promises to resolve. | |
*/ | |
class Cache { | |
constructor() { | |
this.store = {}; | |
} | |
async get(key) { | |
return this.store[key]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Streaming json writer. Call generator to set up, | |
* file isn't opened until you call send(). | |
* | |
* Pass objects with send until you're done. You can call send(null) to close | |
* or let the finally finish up and close out the file at end of execution. | |
* | |
* @param string $file - File path to write to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function progressGen(ProgressBar $bar, $itr) | |
{ | |
$bar->start(); | |
try { | |
foreach($itr as $k => $v) { | |
yield $k => $v; | |
$bar->advance(); | |
} | |
} finally { | |
$bar->finish(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ProgressBar.php | |
* | |
* Extension of Symfony's ProgressBar to limit redraw's to a minimum time | |
*/ | |
namespace App\Lib; | |
use Symfony\Component\Console\Helper\ProgressBar as SymfonyProgressBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* TempStreamIterator.php | |
* | |
* Caches an iterable into a temporary stream, memory or file backed. | |
* Result is rewindable. | |
* | |
*/ | |
class TempStreamIterator implements \Iterator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy this to Dockerfile | |
# Build with `sudo docker build -t c9 .` | |
# Resulting container is c9 | |
FROM ubuntu:14.04 | |
RUN locale-gen en_US.UTF-8 | |
ENV LANG en_US.UTF-8 | |
ENV LANGUAGE en_US:en | |
ENV LC_ALL en_US.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This one leverages include with a data uri. Can't leverage opcache with it, but | |
* for those of you with a religious fear of eval, this is an alternative. | |
* | |
* Requires allow_url_include to be enabled in php.ini | |
*/ | |
class TwigDataUriStashCache implements \Twig_CacheInterface | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TwigStashCache implements \Twig_CacheInterface | |
{ | |
private $pool; | |
public function __construct(\Stash\Interfaces\PoolInterface $pool) | |
{ | |
$this->pool = $pool; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TwigAPCuCache implements \Twig_CacheInterface | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function generateKey($name, $className) | |
{ | |
$key = "$name;$className"; |
NewerOlder