Skip to content

Instantly share code, notes, and snippets.

@damienalexandre
damienalexandre / facets.php
Created May 28, 2013 08:30
Here is an example of how to get a query Filter from a list of Facet and user query (how to apply a facet on a query) with Elastica.
<?php
/**
* Return query Filter from a list of query string & allowed Facets
*
* @param array $query The user query (facet_name => query, facet_name => query...)
* @param array $allowed_facets An array of Elastica\Facet
*
* @return \Elastica\Filter\AbstractFilter (if multiple filters, they are combined in BoolAnd filter)
*/
private function getFacetsFilters($query, $allowed_facets)
@ryandotsmith
ryandotsmith / a-backbone-js-demo-app-sinatra-backend.md
Created January 22, 2012 01:42
Backbone demo app with sinatra backend

A Backbone.js demo app (Sinatra Backend)

Oct 16 2010

Updates

  • 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments

In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].

@gagarine
gagarine / mysql_multiple_import.bash
Created February 24, 2011 22:34
Import multiple sql file in a mysql database
#!/bin/bash
db=$1
user=$2
passwd=$3
if [ "$db" = "" ]; then
echo "Usage: $0 db_name user password"
exit 1
fi
clear
for sql_file in *.sql; do