Skip to content

Instantly share code, notes, and snippets.

View ostark's full-sized avatar

Oliver Stark ostark

  • Berlin area, countryside
View GitHub Profile
@ostark
ostark / array_unique_bench.php
Last active July 30, 2018 08:31
Craft micro optimization
<?php
/*
* Context:
* https://github.com/craftcms/cms/blob/3f055237e314362b079cbbf63a9be46b9cdcd7c7/src/helpers/Image.php#L65
*/
class ArrayHelper
{
@ostark
ostark / bitbucket-pipelines.yml
Created May 23, 2017 14:21
use Bitbucket Pipelines with fortrabbit
image: php:7.1
pipelines:
branches:
master: # this branch gets deployed
- step:
script:
- apt-get update && apt-get install -y unzip git rsync
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
# change APP and REGION
@ostark
ostark / fortrabbit.yml
Created April 7, 2017 10:01
composer global
pre: pre-deploy.php
sustained:
- vendor
- .composer-global
<?php
/**
* Deploy sensitive files (laravel/passport example)
*
* OAUTH_PRIVATE_KEY (content of oauth-private.key) and OAUTH_PUB_KEY (content of oauth-public.key) must be stored in App Secrets
* https://help.fortrabbit.com/secrets
*
* Call this script post deployment (fortrabbit.yml)
* https://help.fortrabbit.com/deployment-file-v2#toc-a-minimal-example
*/
@ostark
ostark / .htaccess
Last active August 29, 2015 14:17
Cache-Control headers for static assets
<ifModule mod_headers.c>
# Expires after 1 month
<filesMatch ".(gif|png|jpg|jpeg|ico|pdf|svg|js)$">
Header set Cache-Control "max-age=2592000"
</filesMatch>
# Expires after 1 day
<filesMatch ".(css)$">
Header set Cache-Control "max-age=86400"
</filesMatch>
@ostark
ostark / gist:9758796
Created March 25, 2014 10:27
Disallow PHP Easter Eggs
############################################
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine
## your PHP version).
RewriteCond %{QUERY_STRING} \=PHP[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12} [NC]
RewriteRule .* - [F]
@ostark
ostark / AppKernel.php
Last active December 23, 2015 19:29
SF2 performance tweaks for fortrabbit - /app/AppKernel.php - /app/config/config_prod.yml
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
/**
* Fortrabbit (or general NFS related) patch of Symfony AppKernel.
*
*/
class AppKernel extends Kernel