Skip to content

Instantly share code, notes, and snippets.

View benlumley's full-sized avatar

Ben Lumley benlumley

View GitHub Profile
<script>
var timeOnPage = ({{DLV – gtm.timerEventNumber}} * {{DLV – gtm.timerInterval}}) / 1000;
fbq('trackCustom','Blog Tracking',{'Time on page': timeOnPage + 'seconds','page':'{{Page URL}}'});
</script>
@benlumley
benlumley / awesomecodestillinuat.js
Created March 20, 2019 09:52
Add banners into content
jQuery(function ($) {
var $banners = $('aside .ba');
if ($banners.length) {
// find all the headings in post body - we want to put the banners in after headers
var $headings = $('#post_full .span9 > *').filter(':header');
// work out how often to put one in
var inc = Math.floor($headings.length / $banners.length);
var current = inc+1;
[{"name":"location","color":"Red","position":{"x":128,"y":105},"increment":true,"timestamp":true,"softdelete":false,"column":[],"relation":[],"seeding":[]},{"name":"test_zone","color":"Red","position":{"x":120,"y":265},"increment":true,"timestamp":true,"softdelete":false,"column":[],"relation":[],"seeding":[]}]
@benlumley
benlumley / headers.har
Created September 16, 2016 12:08
Headers
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 16 Sep 2016 12:06:30 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
X-Frame-Options: SAMEORIGIN
@benlumley
benlumley / access.log
Created May 28, 2016 07:22
HEAD-BEFORE-GET
72.66.115.10 www.caerleon-arts.org - [28/May/2016:07:17:30 +0000] "HEAD /?apples=2 HTTP/1.1" 200 0 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; PTST 2.295)"
89.238.163.36 www.caerleon-arts.org - [28/May/2016:07:17:42 +0000] "GET /?apples=2 HTTP/1.1" 200 7911 "-" "Mozilla/5.0 (Windows NT 6.1; rv:46.0) Gecko/20100101 Firefox/46.0 PTST/278"
Found SELinux - setting security context to: texrel_shlib_t for *.so files.
Got @INC containing:
/usr/share/squeezeboxserver/CPAN
/usr/share/squeezeboxserver
/usr/sbin
/etc/perl
/usr/local/lib/perl/5.18.2
/usr/local/share/perl/5.18.2
/usr/lib/perl5
/usr/share/perl5
# Running with --d_startup:
$ /usr/bin/perl /usr/sbin/squeezeboxserver --prefsdir /var/lib/squeezeboxserver/prefs --logdir /var/log/squeezeboxserver/ --cachedir /var/lib/squeezeboxserver/cache --charset=utf8 --norestart --d_startup
Found SELinux - setting security context to: texrel_shlib_t for *.so files.
Got @INC containing:
/usr/share/squeezeboxserver/CPAN
/usr/share/squeezeboxserver
/usr/sbin
/etc/perl
[~]$ brew cask *[master][2.0.0-p481]
Error: uninitialized constant Gem::UserInteraction
Please report this bug:
https://github.com/Homebrew/homebrew/wiki/troubleshooting
/Library/Ruby/Site/1.8/rubygems/ext/builder.rb:12
/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
/Library/Ruby/Site/1.8/rubygems/ext.rb:13
/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
{
"vars": {
"@gray-darker": "lighten(#000, 13.5%)",
"@gray-dark": "lighten(#000, 20%)",
"@gray": "lighten(#000, 33.5%)",
"@gray-light": "lighten(#000, 60%)",
"@gray-lighter": "lighten(#000, 93.5%)",
"@brand-primary": "#428bca",
"@brand-success": "#5cb85c",
"@brand-info": "#5bc0de",
@benlumley
benlumley / gist:9517689
Created March 12, 2014 22:18
Bits from events manager for registering a new user behind the scenes with a generated pw, then emailing them
<?php
/**
* Decides whether to register a user based on a certain booking that is to be added
* @param EM_Booking $EM_Booking
*/
function em_booking_add_registration( $EM_Booking ){
global $EM_Notices;
//Does this user need to be registered first?
$registration = true;
if( ((!is_user_logged_in() && get_option('dbem_bookings_anonymous')) || defined('EM_FORCE_REGISTRATION')) && !get_option('dbem_bookings_registration_disable') ){