Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lperrin on github.
  • I am lperrin (https://keybase.io/lperrin) on keybase.
  • I have a public key whose fingerprint is 1782 E580 C9CB A9A2 87A1 E211 960A C648 7F97 C30C

To claim this, I am signing this object:

[$http:badreq] Http request configuration url must be a string. Received: null
http://errors.angularjs.org/1.5.0/$http/badreq?p0=null
https://app2.frontapp.com/build/js/libs.min.js?v=1463029656879:7:386
d@https://app2.frontapp.com/build/js/libs.min.js?v=1463029656879:8:15643
https://app2.frontapp.com/build/js/libs.min.js?v=1463029656879:8:16766
load@public/js/app/inboxes/cells/conversations_model.js:164:23
load@public/js/app/inboxes/cells/cells.js:86:27
stateChangeSuccess@public/js/app/inboxes/cells/cells.js:180:16
public/js/app/inboxes/cells/cells_ctrl.js:268:31
$broadcast@https://app2.frontapp.com/build/js/libs.min.js?v=1463029656879:9:11181
[Warning] Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"No current subscription to channel private-conversation-72291667, or subscription in progress"}}} (libs.min.js, line 1)
[Warning] Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":1006,"message":"Connection interrupted (200)"}}} (libs.min.js, line 1)
[Info] pusher connecting (libs.min.js, line 8)
[Info] pusher connected (libs.min.js, line 8)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (smooch, line 0)
[Log] pushState (3) (app.min.js, line 244)
[Log] pushState (3) (app.min.js, line 244)
[Log] pushState (3) (app.min.js, line 244)
[Log] pushState (3) (app.min.js, line 244)
[Warning] The page at https://app2.frontapp.com/inboxes/team/me/assigned/received/101125094 was allowed to display insecure content from http://codestarssummit.com/miscpages/header_svcc_2016.png. (libs.min.js, line 5)
<br>
<strong>HOW NICE WAS MY REPLY?</strong><br>
<a href="{{nicereply.awesome_url}}" target="_blank"><img alt="Awesome" src="/path/to/awesome.png"></a>
<a href="{{nicereply.nice_url}}" target="_blank"><img alt="Nice" src="/path/to/nice.png"></a>
<a href="{{nicereply.boo_url}}" target="_blank"><img alt="Boo!" src="/path/to/boo.png"></a>
<br>

Open Hours

A team responding to customers' requests may only be available during certain hours during the week. These open hours could be for example:

  • Monday: 9am to 5pm
  • Tuesday: 9am to 5pm
  • Wednesday: 9am to 5pm
  • Thursday: 9am to 5pm
  • Friday: 9am to 5pm
function a() {
setTimeout(function () {
throw new Error('hi');
}, 0);
}
function b() {
a();
}
function extractHandle(data) {
var sourceIsIntercomFriendly = data.contact.source === 'email' || data.contact.source === 'intercom';
if (!data.contact || !sourceIsIntercomFriendly)
return null;
if (!/@mail.intercom.io/i.test(data.contact.handle))
return data.contact.handle;
// we need to go back to the messages to get the real intercom contact
if (!data.conversation)
return null;
for (var i = 0; i < data.conversation.messages.length; i++) {
var _ = require('underscore'),
moment = require('moment-timezone'),
Chart = require('chart.js');
ngModule.controller('analyticsChartCtrl', function ($scope, $element, analytics) {
var ctx = $element.find('#graph')[0].getContext('2d');
var oldChart = null;
$scope.analytics = analytics;
$scope.chart = new Chart(ctx);
@lperrin
lperrin / magic_number.md
Last active February 18, 2017 01:15
Find the magic number

Find the magic number

The goal is to find the smallest number (let's call it M) such that:

  • If M obeys property X, then the digit X is part of the number.
  • If M does not obey property X, then the digit X is NOT part of the number.

For example, if 2457 were a magic number, it would obey properties 2, 4, 5, 7 and not 0, 1, 3, 6, 8, 9. However we find that not to be the case, so it is not the number we are looking for.

Properties

var glou = require('glou');
var gulpIf = require('gulp-if'),
gulpInsert = require('gulp-insert'),
gulpSourcemaps = require('gulp-sourcemaps'),
gulpWrapCommonjs = require('gulp-wrap-commonjs'),
gulpNgAnnotate = require('gulp-ng-annotate'),
gulpUglify = require('gulp-uglify'),
gulpConcat = require('gulp-concat');