Skip to content

Instantly share code, notes, and snippets.

INPUT="$1"
XML=$(basename "$1" .adoc).xml
asciidoctor -b docbook -d article "$1"
fopub "$XML"
rm "$XML"
@PaulMougel
PaulMougel / index.js
Created May 6, 2014 12:18
Hapi hanging with plugin dependency
var Hapi = require('hapi');
var plugins = {
yar: {
cookieOptions: {
password: "mypassword",
isSecure: false
}
},
travelogue: {
var charts = ["#drug", "#clinical", "#mri", "#disease", "#gd", "#relapses"].map(function (chart) {
return datachart.compositeChart(chart);
});
charts.push(datachart.barChart("#monthly-chart"));
var svg = element.children('svg');
function compile () { $compile(svg)(scope); };
charts.map(function (chart) { chart.on('postRender', compile); });
@PaulMougel
PaulMougel / index.js
Last active August 29, 2015 14:02
Sequelize: TypeError: Cannot read property 'through' of null
var Sequelize = require('sequelize');
var Promise = require('bluebird');
var sequelize = new Sequelize('test', 'pmougel', '', {
logging: false,
dialect: 'postgres',
omitNull: true
});
var User = sequelize.define(
{"event":"request","timestamp":1400685220411,"id":"1400685220411-98077-30707","instance":"https://localhost:8081","labels":[],"method":"get","path":"/public/scripts/directives/navBar.js","query":{},"source":{"remoteAddress":"127.0.0.1","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0","referer":"https://localhost:8081/public/"},"responseTime":8,"statusCode":304,"log":[{"request":"1400685220411-98077-30707","timestamp":1400685220411,"tags":["hapi","received"],"data":{"id":"1400685220411-98077-30707","method":"get","url":"/public/scripts/directives/navBar.js","agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"}},{"request":"1400685220411-98077-30707","timestamp":1400685220416,"tags":["hapi","handler"],"data":{"msec":1.6566630005836487}},{"request":"1400685220411-98077-30707","timestamp":1400685220419,"tags":["hapi","response"]},{"request":"1400685220411-98077-30707","timestamp":1400685220421,"tags":["hapi","internal","implemen
@PaulMougel
PaulMougel / npm-debug.log
Created August 20, 2014 13:22
rstats install fails
~/t/rstats ❯❯❯ npm i rstats ⏎
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm http GET https://registry.npmjs.org/rstats
npm http GET https://registry.npmjs.org/rstats
npm http 304 https://registry.npmjs.org/rstats
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
@PaulMougel
PaulMougel / gist:b962949958e26e932b8a
Last active August 29, 2015 14:06
hapi gzip issue

Image 280, served from filesystem

MD5 (/image/280 from Chrome)              = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280.nii.gz from Chrome)       = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280 from curl)                = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280.nii.gz from curl)         = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280 from Firefox)             = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280.nii.gz from Firefox)      = 66e40034de146a20ce146df0eccb184b
MD5 (image stored on filesystem)          = 00f543dd8a14fa23f6b43806a97cd415
@PaulMougel
PaulMougel / fix-css-classes.sh
Last active August 29, 2015 14:08
Fix material-design-icons CSS classes
set -e
for filename in *.css
do
category=${filename%.*}
category=${category#sprite-}
sed "s/^\.icon/\.icon-$category/" < $filename > $filename.new
mv -f $filename.new $filename
done
@PaulMougel
PaulMougel / 0-installation.sh
Last active June 21, 2016 10:19
Attachment upload & indexation in Elasticsearch
# https://github.com/elasticsearch/elasticsearch-mapper-attachments
plugin install elasticsearch/elasticsearch-mapper-attachments/2.4.2
curl -X PUT http://localhost:9200/test
# Note that here we declare that the attachement is stored in the field "my_attachment"
curl -X PUT http://localhost:9200/test/pdf/_mapping -d '{"pdf": {"properties": {"my_attachment": {"type": "attachment"}}}}'
@PaulMougel
PaulMougel / index.js
Created April 1, 2015 08:08
bind example
var express = require('express');
var Logger = function (level) {
this.level = level;
this.log = function (message) {
if (message === undefined) {
message = "...";
}
console.log('[' + this.level + '] ' + message);
};