This file contains hidden or 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
# WebPage uses cache??? What the heck is cache in context of a webpage crawling process? It should only crawl pages. You need to inject some dummy cache to prevent caching. | |
Yeah, that's the assignment as I see it? The crawler crawls and caches stuff it has found and parsed. Your comments are cryptic .) | |
# thumnail generation is an expensive job, thus lazy-loading. But you are not saving already generated thumbnails in cache. :( | |
I guess it's pretty obvious the thumbnail stuff is just for illustration, isn't it? But yeah, definitely it should save the generated thumbnail in the cache! But guess what, probably in some hypothetic Thumbnail class? Not in WebPage class? | |
This file contains hidden or 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(doc) { | |
if (doc.content) { | |
var html = new XML('<foo>bar</foo>'); | |
emit('bar', 1); | |
} | |
} |
This file contains hidden or 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
class AnnouncementsController < ApplicationController | |
def index | |
pagination_options = { :page => params[:page], :per_page => params[:per_page] } | |
@announcements = Announcement.by_admins( params[:archived], pagination_options ) | |
end | |
end |
This file contains hidden or 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 Change = function (id, doc) { | |
console.log('new change:', id); | |
this.id = id; | |
this.glyph = $('<p title="' + this.url() + '"></p>') | |
.css({ bottom: this.position() }) | |
.click($.proxy(this.onGlyphClick, this)); | |
this.changes_in_current_period += 1; | |
$('#changes .interval:last') |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<!-- This should be the simplest possible jQuery based CouchApp. Install by uploading to a design document in Futon or putting in _attachments/index.html and running `couchapp push` --> | |
<head><title>Tiny CouchApp</title></head> | |
<body> | |
<h1>Tiny CouchApp</h1> | |
<ul id="databases"></ul> | |
</body> | |
<script src="/_utils/script/jquery.js"></script> | |
<script src="/_utils/script/jquery.couch.js"></script> |
This file contains hidden or 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
# Setup | |
curl -X DELETE 'http://localhost:9200/news_cs/' | |
curl -X DELETE 'http://localhost:9200/news_en/' | |
# Create Czech and English indices (databases) | |
curl -X PUT 'http://localhost:9200/news_cs/' | |
curl -X PUT 'http://localhost:9200/news_en/' | |
# Create mapping for Czech documents | |
curl -X PUT 'http://localhost:9200/news_cs/_mapping' -d ' |
This file contains hidden or 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
curl -XPUT ${host}/_template/template_mail -d ' | |
{ | |
"template" : "*", | |
"settings" : { | |
"number_of_shards" : 3, | |
"number_of_replicas" : 1 | |
}, | |
"mappings" : { | |
"mail" : { | |
"_index" : { "enabled" : true }, |
This file contains hidden or 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
# ======================================== | |
# Testing multiple analyzers per field | |
# ======================================== | |
# Setup | |
curl -s -X DELETE 'http://localhost:9200/news_test/' | |
# Create index with settings and mapping | |
curl -s -X PUT 'http://localhost:9200/news_test' -d ' | |
{ |
This file contains hidden or 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
module Tire | |
module Scroll | |
DEFAULT_SCROLL_DURATION = '1m' | |
class Scroll | |
attr_reader :search, :total, :remaining, :counter | |
def initialize(indices=nil, options={}, &block) | |
@search = Tire::Search::Search.new(indices, options, &block) | |
@options = options |
This file contains hidden or 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
source "http://rubygems.org/" | |
gem "sinatra", "~> 1.3.0" | |
gem "thin" |