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
library(lme4) | |
bats <- structure(list(Indvar1 = c(0, 5, 10, 19, 30, 33, 39, 44, 54, | |
63, 68, 72, 81, 87, 93, 100, 105, 110, 119, 127, 134, 141, 149, | |
155, 115, 120, 125, 0, 5, 9, 17, 22, 29, 35, 39, 44, 45, 50, | |
55, 63), IndvarType = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, | |
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, | |
3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, | |
3L), .Label = c("CONTROL", "LED", "Metal Halide", "SOX"), class = "factor"), | |
IndvarCat = c(26.9, 25.16, 39, 29.81, 21.83, 20.22, 2.9, |
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 | |
namespace Mysite\Command; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Bolt\Application; |
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 | |
// Assuming you have a repeater field named `performances` and within each set there's a field named performancetime which is a datetime. | |
// The example is in PHP code, if you want to use it in Twig then you'll need to put this code in a method and use a Twig Filter to point | |
// to the method | |
$iterator = $record['performances']->getIterator(); | |
$iterator->uasort(function ($first, $second) { | |
if ($first === $second) { |
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 line needs to be called after initialize but before run | |
$app['upload'] = $app->extend( | |
'upload', | |
function ($handler, $app) { | |
$handler->setSanitizerCallback(function ($filename) { | |
return $filename; | |
}); | |
return $handler; |
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 | |
namespace Myapp\Response; | |
use Symfony\Component\HttpFoundation\Response; | |
class CsvResponse extends Response | |
{ | |
protected $data; |
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 line needs to be called after initialize but before run | |
$app['upload'] = $app->extend( | |
'upload', | |
function ($handler, $app) { | |
if ($app['request']->get('contenttypeslug') && $app['request']->get('id')) { | |
$handler->setPrefix("/".$app['request']->get('contenttypeslug')."/".$app['request']->get('id')); | |
} | |
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 | |
// A method looks like this assuming that you are passed a $request instance that contains all the needed info | |
$builder = new ContainerBuilder(); | |
$builder->addDefinitions(__DIR__."/config/services.php"); | |
$container = $builder->build(); | |
$routeInfo = $this->dispatcher->dispatch($request->getMethod(), $request->getPathInfo()); |
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 | |
$dispatcher = FastRoute\simpleDispatcher(function(FastRoute\RouteCollector $r) { | |
$r->addRoute('GET', '/', 'MyApp\Action\Index'); | |
$r->addRoute('GET', '/example/{parameter}', 'MyApp\Action\Example'); | |
}); |
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 | |
use Bolt\Thumbs\ThumbnailResponder; | |
class S3ThumbnailResponder extends ThumbnailResponder | |
{ | |
/** | |
* Gets raw image data for the thumbnail. | |
* |
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
$app['cache'] = $app->share( | |
function (Application $app) { | |
$memcache = new Memcache(); | |
$memcache->connect('127.0.0.1', 11211); | |
$cacheDriver = new \Doctrine\Common\Cache\MemcacheCache(); | |
$cacheDriver->setMemcache($memcache); | |
return $cacheDriver; | |
} | |
); |