Skip to content

Instantly share code, notes, and snippets.

View callumacrae's full-sized avatar

Callum Macrae callumacrae

View GitHub Profile
@callumacrae
callumacrae / gist:5c21f1ae3fdef948316f
Last active September 3, 2015 09:46
Using service workers to mitigate the affect of a failing SPOF
We have a blocking script (Optimizely) in the head of our website that we have no control over and
cannot move to the footer. If this script were to somehow go down, then our site would effectively
go down, too. I was thinking about measures we could take so that if Optimizely does go down, it
doesn't take our site with it. One possible approach could be to use service workers.
36.4% of our traffic supports service workers. 28% of that is returning visitors, and will already
have the service worker installed (this is important; the service worker would be installed after
the potential failing script). That's 2700 visitors a day. We can use service workers on these
browsers to detect when Optimizely is down or very slow, and let the server know via an AJAX request.
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports !== "undefined") {
console.log('test');
factory(exports);
} else {
var mod = {
exports: {}
$.ajax({
method: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize()
});
// Why not this?
$.ajax($form);
'use strict';
const path = require('path');
const git = require('nodegit');
const promisify = require('promisify-node');
const fs = promisify(require('graceful-fs'));
const winston = require('winston');
const config = require('./config');
11:42 cyberbrai| any know about basic concepts of drag and drop
11:44 callumacrae| cyberbrai: the basic concepts?
11:44 callumacrae| how basic?
11:45 callumacrae| you pick stuff up
11:45 callumacrae| and you drag it about
11:45 callumacrae| and you drop it somewhere
11:45 callumacrae| hope that helps
11:45 cyberbrai| callumacrae yup actually i want to get the text of droppable item
but can't
11:45 yansanmo| callumacrae, explain how do you drag, with the mouse?
var bundler = browserify(options.src);
return bundler.bundle()
.on('error', options.onError)
.pipe(source(basename))
.pipe(gulp.dest(options.dest))
.pipe(buffer())
//.pipe(rev(gulp, plugins, options))
.on('end', function () {
console.log('TEST');
$color: blue
body .div
color: $color
Aug 2012: 23
Sep 2012: 183
Oct 2012: 23
Nov 2012: 71
Dec 2012: 18
Jan 2013: 25
Feb 2013: 435
Mar 2013: 460
Apr 2013: 80
May 2013: 77
$('.something').on({
click: function () {},
mouseout: function () {}
});
// How do I shorten this?
$(document).on('click', '.something', function () {})
$(document).on('mouseout', '.something', function () {})
@callumacrae
callumacrae / file-1.yml
Created August 10, 2014 15:25
ansible bug? untested
- name: Don't include a file
include: file-2.yml
when: false