This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = function() { | |
this.nb_books = this.books.length; | |
emit(this._id, this); | |
} | |
r = function(k,v) { | |
return v[0]; | |
} | |
db[db.authors.mapReduce(m, r).result].find().sort({nb_books:-1}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_test_completion() | |
{ | |
php -r "echo 'coucou';" > /dev/null # useless call to PHP | |
# Any call to PHP will make this occur: I was trying to parse the output of Symfony2's app/console | |
# and had a huge headache before I just made this test... and gave up. | |
COMPREPLY=( $(compgen -W "world myself everyone") ) | |
} | |
complete -o default -F _test_completion hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
dumb: | |
class: Acme\DumbService | |
arguments: | |
- "name" | |
- "hello": { "world": { "foo": %mailer_host% } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2011 Google Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backend default { | |
.host = "test-esi.localhost"; | |
.port = "8000"; | |
} | |
sub vcl_fetch { | |
esi; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ajax(options) { | |
options = Object.extend({ | |
"method": "POST", | |
"error": function() {}, | |
"success": function() {}, | |
// ... | |
}, options || {}) | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Liste des threads du forum */ | |
const threads = [ | |
{ id: 1, title: 'First thread' }, | |
{ id: 33, title: 'Oh noes, Jesus died' }, | |
{ id: 42, title: 'Ze answer' } | |
] | |
/** Déclaration de l'application */ | |
var app = require('express').createServer().configure(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: | |
// var express = require('express') | |
// require('enableMultipleViewRoots')(express) | |
module.exports = function(express) { | |
var old = express.view.lookup; | |
function lookup(view, options) { | |
// If root is an array of paths, let's try each path until we find the view | |
if (options.root instanceof Array) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express.createServer() | |
// Configuration | |
app.configure(function() { | |
this.set('views', __dirname + '/views') | |
.set('view engine', 'jade') | |
.use(express.static(__dirname + '/public')) | |
.set('view options', {title: 'Express'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class c { | |
public $f; | |
public function __construct() { | |
$this->f = function() { echo 'coucou'; }; | |
} | |
} | |
// Note: "public $f = function() {...}" is a syntax error... |
OlderNewer