View gist:099ef5ec61f870a07e56
1 2 3 4 5 6 7 8 9
{ [Error: SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[2sj2k_hAQWKeObWgAzBZhw][events][0]:
SearchParseException[[events][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"filtered":{"filter":{"geo_distance":{"distance":"1km",
"geopoint":{"lat":48.507351,"lon":-0.127758}}}}}]]]; nested: SearchParseException[[events][0]: from[-1],size[-1]: Parse Failure [No parser for elemen
t [filtered]]]; }]]
status: '400',
message: 'SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[2sj2k_hAQWKeObWgAzBZhw][events][0
]: SearchParseException[[events][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{"filtered":{"filter":{"geo_distance":{"distance":"1km
","geopoint":{"lat":48.507351,"lon":-0.127758}}}}}]]]; nested: SearchParseException[[events][0]: from[-1],size[-1]: Parse Failure [No parser for elem
ent [filtered]]]; }]' }
View Describing Y Combinator
1 2 3 4 5 6 7 8 9 10
// the original Y Combinator is here: https://leanpub.com/javascript-allonge/read#y
// have a look at that soup of function and return
// I refactored it down to the below version
// I hope is correct, too tired now.
 
// used like this
var factorial = Y(
// next
function(fac) {
return function(n) {
View ?. in JavaScript
1 2 3 4 5 6 7 8 9
macro ?. {
rule infix {
$lhs:expr | $rhs:expr
} => {
$lhs && $lhs.$rhs
}
}
 
// obj?.possiblyNullProperty
View version bump with prompt offered
1 2 3 4 5 6 7 8 9 10
bump: {
options: {},
files: ['package.json']
},
prompt: {
bump: {
options: {
questions: [{
config: 'bump.options.level',
type: 'list',
View Gruntfile.js
1 2 3 4 5 6 7 8 9 10
module.exports = function (grunt) {
 
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
preprocess: {
options: {
context : {
answer: 42
}
View sum palindromic numbers
1 2 3 4 5 6 7 8 9 10
# Find the sum of all numbers, less than ten million, which are palindromic
# in base 10 and base 2 (leading zeros are ignored.)
 
# idea: a number is palindrome when once reversed is still equal to iself
isPalindrome = (number, radix) ->
reversed = number.toString().split('').reverse().join('')
parseInt(reversed, radix) is parseInt(number, radix)
 
result = [1..10000000].filter((number) ->
isPalindrome(number, 10) and isPalindrome(number.toString(2), 2)
View horde simple expectation
1 2 3 4 5 6 7 8 9
var expectation = function (found, cb) {
'use strict';
 
var expected = 'Sample site';
cb(found === expected, found, expected);
};
 
module.exports = function (instance, cb) {
'use strict';
View gist:4527072
1 2 3
process.on('uncaughtException', function(err) {
console.log(err);
});
View gist:4527064
1 2 3 4 5 6 7 8 9 10
var processDomain = require('domain').create();
 
processDomain.on('error', function(err) {
console.log('error received');
console.log(err.domain.members);
return processDomain.dispose();
});
 
var runner = function(parameter) {
processDomain.add(parameter);
View gist:3866869
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/perl
# License: Same as GTK2
use strict;
use warnings;
use Gtk2 '-init';
 
my $event = Gtk2::Gdk::Event->new("GDK_CLIENT_EVENT");
$event->send_event(1);
$event->window(undef);
$event->message_type(Gtk2::Gdk::Atom->intern("_GTK_READ_RCFILES", 0));
Something went wrong with that request. Please try again.