Skip to content

Instantly share code, notes, and snippets.

@ianchadwick
ianchadwick / fluentd-lumen.conf
Last active March 9, 2016 08:24
fluentd / google compute logging for Lumen logs
<source>
type tail
format multiline
format_firstline /\[\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}\]/
format1 /^\[(?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2})\] lumen.(?<level>[^\s]+)(?<message>.*)/
path /path/to/my-site/storage/logs/lumen.log
pos_file /var/lib/google-fluentd/pos/lumen.pos
read_from_head true
tag lumen
</source>
@ianchadwick
ianchadwick / cross-domain-iframe-height.js
Last active February 21, 2016 09:21
Use postMessage to tell the parent window the size of the current window height - for parent window implementation see https://gist.github.com/ianchadwick/a4e277d641bf739063c9
<script>
/**
* For parent window implementation details
* @see https://gist.github.com/ianchadwick/a4e277d641bf739063c9
*/
(function (speed) {
if (parent === window) {
// no parent frame!
return;
}
@ianchadwick
ianchadwick / cross-domain-iframe-resizing.js
Created February 14, 2016 10:52
Resize iframes cross domain for Mizmoz email previews
(function () {
var listenForWindowHeight = function (event) {
var parts = event.data.split('|');
// check the message is relevant
if (parts[0] != 'iframe-height') {
return;
}
// this check is only really needed if you have multiple iframes on the same page or are experiencing message name clashes
if (parts[1] != 'http://www.my-iframe-src.com/path') {
@ianchadwick
ianchadwick / hhvm.conf
Created January 19, 2016 09:10
fluentd / google compute logging / google-fluentd configuration for logging hhvm errors
<source>
type tail
format none
path /var/log/hhvm/error.log
pos_file /var/lib/google-fluentd/pos/hhvm-error.pos
read_from_head true
tag hhvm-error
</source>