Skip to content

Instantly share code, notes, and snippets.

@addame
addame / will_paginate.rb
Created November 23, 2011 14:28 — forked from leifcr/will_paginate.rb
Extends will_paginate to play well with Twitter's Bootstrap (http://twitter.github.com/bootstrap/). Suggested location: config/initializers/will_paginate.rb
# https://gist.github.com/1305042
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@addame
addame / es.txt
Created February 17, 2012 01:07 — forked from karussell/Query-DSL-elasticsearch.txt
Bird's Eye View on ElasticSearch its Query DSL
Several times in a month there pop up questions regarding query structure on the ElasticSearch user group.
Although there are good docs explaining this in depth probably the bird view of the Query DSL is necessary to
understand what is written there. There is even already some good external documentation available:
http://www.elasticsearch.org/tutorials/2011/08/28/query-dsl-explained.html
And there were attempts to define a schema:
http://groups.google.com/group/json-schema/browse_thread/thread/ae498ee818155d50
https://gist.github.com/8887766ca0e7052814b0
#!/bin/bash
# This script may be used to backup files having a specific extension
source="/path/to/source/dir"
dest="/path/to/rep/backup"
day=$(date +%d-%m-%Y)
# backup img files
@addame
addame / README.markdown
Created March 20, 2012 01:30 — forked from isc/README.markdown
A micro gem providing an accordion view helper that generates the proper markup for Twitter Bootstrap

In your Gemfile:

gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git'

In your views:

= accordion do |accordion|

= accordion.pane 'My first pane' do

@addame
addame / gist:2362591
Created April 11, 2012 21:08 — forked from lukas-vlcek/gist:1012051
Full search query #BBUZZ 2011
{
"from" : 0,
"query" : {
"filtered" : { "query" : { "query_string" : { "query" : "jboss server" } },
"filter": {
"and" : [
{"range" : { "date" : {"from":"2007-07-25","to":"2010-12-16"}}},
{"terms" : { "_index" : ["weld"]}},
{"terms" : {"mail_list" : ["dev"]}},
{"terms" : {"from.not_analyzed" : [ "Galder Zamarreno <[email protected]>","Pete Muir <[email protected]>"]}}
@addame
addame / gist:2406542
Created April 17, 2012 14:58 — forked from lukas-vlcek/gist:1012051
Full search query #BBUZZ 2011
{
"from" : 0,
"query" : {
"filtered" : { "query" : { "query_string" : { "query" : "jboss server" } },
"filter": {
"and" : [
{"range" : { "date" : {"from":"2007-07-25","to":"2010-12-16"}}},
{"terms" : { "_index" : ["weld"]}},
{"terms" : {"mail_list" : ["dev"]}},
{"terms" : {"from.not_analyzed" : [ "Galder Zamarreno <[email protected]>","Pete Muir <[email protected]>"]}}
@addame
addame / rails_helper.rb
Created April 28, 2012 21:07 — forked from Amitesh/rails_helper.rb
Accessing Helper modules in rails
Accessing Helper modules in rails
http://www.funonrails.com/2010/12/accessing-helper-modules-in-rails.html
1. Helper methods all the time for views
class ApplicationController < ActionController::Base
helper :all# include all helpers, all the time for views
end
{
"from" : 0,
"size" : 10,
"query" : {
"match_all" : {
}
},
"explain" : false,
"facets" : {
"f1" : {
@addame
addame / devise.fr.yml
Created May 1, 2012 21:56 — forked from tadatoshi/devise.fr.yml
I18n French translation for Devise (http://github.com/plataformatec/devise)
#########################################################################################################
# I18n French translation for Devise (http://github.com/plataformatec/devise)
# I18n traduction française pour Devise
#########################################################################################################
fr:
errors:
messages:
not_found: "n'a pas été trouvé(e)"
already_confirmed: "a déjà été confirmé(e)"
curl -XDELETE 'localhost:9200/test'
# grasp available rules with: jar tvf plugins/analysis-phonetic/commons-codec-*.jar | grep bm
curl -XPUT 'localhost:9200/test' -d '
{
"settings" : {
"index" : {
"analysis" : {