Skip to content

Instantly share code, notes, and snippets.

class FlioDefaults {
enum Key: String {
case unloggedUserVouchers = "FLIOUnloggedUserVouchers"
case sentCalendarEvents = "FLIOSentCalendarEventsKey"
case recentSearchAirportIds = "recentAirportSearchUIDs"
case calendarPermissionsGranted = "FLIOcalendarPermissionsGranted"
case calendarPermissionsRequested = "FLIOcalendarPermissionsRequested"
}
// static let foo = NativeProperty<String>(.testKey, default: "foo")
initArticleImages: ->
@element.find(".article__body img").each ->
self = $(@)
if alt = self.attr("alt")
wrapper_div = $('<div></div>').addClass(self.attr("class"))
self.attr("class", "")
wrapper_div.appendTo(self.parent("p"))
@jarosan
jarosan / elasticsearch.rake
Created July 16, 2012 20:37
Elasticsearch reindex task
# Run with: rake environment elasticsearch:reindex
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klass = Place
ENV['CLASS'] = klass.name
ENV['INDEX'] = new_index = klass.tire.index.name << '_' << Time.now.strftime('%Y%m%d%H%M%S')
:seasons => [
{
:from => 20010101,
:to => 20120101,
:price => 75,
:weekend_price => 100
},
{
:from => 20120102,
:to => 20150101,
curl -X GET "http://localhost:9200/development_places/place/_search?pretty=true" -d '
{
"query" : {
"filtered" : {
"query" : {
"custom_score" : {
"query" : {
"match_all":{}
},
"script" : "_source.search_ranking * -1"
curl -X GET "http://localhost:9200/development_places/place/_search?pretty=true" -d '
{
"query" : {
"custom_score" : {
"query": {
"filtered" : {
"query" : {"match_all":{}},
"filter" : [
{
"and" : [ {"geo_bounding_box":{"location":{"top_left":[13.0535,52.6675],"bottom_right":[13.7262,52.3303]}}},{"range":{"number_of_beds":{"gte":2}}}]