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
/** | |
* @module TimeStamp | |
* @todo Unit tests | |
*/ | |
'use strict'; | |
var moment = require('moment'); | |
/** | |
* @class | |
* @param {TimeStamp|string} [src] - A timestamp to parse |
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
/* | |
* Not actually a JS file; Normally you'd break these components up. | |
*/ | |
/* creating the database connection */ | |
var db = new Sequelize('database', 'username', 'password', ...); | |
/* loading the models */ | |
var fs = require('fs'); | |
var path = require('path'); |
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
var koa = require('koa'); | |
var app = koa(); | |
var router = require('koa-router')(); | |
var util = require('util'); | |
var compress = require('koa-compress') | |
app | |
.use(compress({ | |
threshold: 5, | |
flush: require('zlib').Z_SYNC_FLUSH |
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"; |
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 | |
/** | |
* 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
# 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 | |
/** | |
* 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
<?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
function progressGen(ProgressBar $bar, $itr) | |
{ | |
$bar->start(); | |
try { | |
foreach($itr as $k => $v) { | |
yield $k => $v; | |
$bar->advance(); | |
} | |
} finally { | |
$bar->finish(); |
OlderNewer