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
.... | |
<h2>Installation</h2> | |
<p>OK. First, you need a running <em>Elasticsearch</em> server. Thankfully, it's easy. Let's define easy:</p> | |
<pre><code>$ curl -k -L -o elasticsearch-0.20.2.tar.gz http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz | |
$ tar -zxvf elasticsearch-0.20.2.tar.gz | |
$ ./elasticsearch-0.20.2/bin/elasticsearch -f | |
</code></pre> |
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
<html> | |
<head> | |
<title> | |
Demo Cross Domain | |
</title> | |
<!-- Le styles --> | |
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet"> | |
<style> | |
body { |
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
[github] | |
user = miry | |
[user] | |
name = Michael Nikitochkin | |
email = <email> | |
comment = miry | |
signingkey = xxxxx | |
[alias] |
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
require 'benchmark' | |
n = 50000000 | |
Benchmark.bm(15) do |x| | |
x.report("regexp1") { 1.upto(n) do ; "XMLHttpReQUEst" =~ /XMLHttpRequest/i; end } | |
x.report("regexp2") { 1.upto(n) do ; "XMLHttpReQUEst" =~ /xmlhttprequest/i; end } | |
x.report("downcase") { 1.upto(n) do ; 'XMLHttpReQUEst'.downcase == 'xmlhttprequest'; end } | |
x.report("strip+downcase") { 1.upto(n) do ; ' XMLHttpReQUEst '.strip!.downcase! == 'xmlhttprequest'; 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
def max_overshoot(task_table) | |
@cache_result ||= {} | |
result = @cache_result[task_table] | |
return result if result | |
prev = 0 | |
prev = max_overshoot(task_table[0..-2]) if task_table.size > 1 | |
total_duration = task_table.reduce(0) {|i, s| i+s[:duration]} |
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
def pairs(numbers, diff) | |
counter = 0 | |
numbers.sort! | |
n = numbers.length | |
numbers.each_with_index do |val, i| | |
j = i + 1 | |
subject = val + diff | |
j += 1 while j < n && numbers[j] < subject | |
while numbers[j] == subject |
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
def partition(ar) | |
p = ar[0] | |
i = 1 | |
j = ar.size - 1 | |
while i<j | |
i+=1 while i < j && ar[i]<p | |
j-=1 while j>=i && ar[j]>p | |
swap(ar,i,j) if i < j | |
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
def insertionSort(ar) | |
j = 1 | |
while j < ar.size | |
i = j - 1 | |
key = ar[j] | |
while i >= 0 && key < ar[i] | |
ar[i+1]=ar[i] | |
puts ar.join(" ") | |
i -= 1 | |
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
module TireSearch | |
class Setup | |
class << self | |
def settings_options | |
{ | |
number_of_shards: 1, | |
number_of_replicas: 0, | |
analysis: { | |
char_filter: { |
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
alias pp_json='ruby -e "require \"json\"; require \"yaml\"; puts JSON.parse(STDIN.read).to_yaml"' |