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
3572 zzForAction: { | |
3573 while (true) { | |
3574 | |
3575 if (zzCurrentPosL < zzEndReadL) | |
3576 zzInput = zzBufferL[zzCurrentPosL++]; | |
3577 else if (zzAtEOF) { | |
3578 zzInput = YYEOF; | |
3579 break zzForAction; | |
3580 } | |
3581 else { |
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 'restclient' | |
# RestClient logs using << which isn't supported by the Rails logger, | |
# so wrap it up with a little proxy object. | |
RestClient.log = | |
Object.new.tap do |proxy| | |
def proxy.<<(message) | |
Rails.logger.info message | |
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
$ curl http://10.11.0.6:9200/migrations/_settings | |
{"migrations":{"settings":{"index.number_of_shards":"1","index.auto_expand_replicas":"1-all","index.number_of_replicas":"2"}}} | |
$ curl http://10.11.0.6:9200/migrations/_settings?pretty=true | |
{ | |
"migrations" : { | |
"settings" : { | |
"index.number_of_shards" : "1", | |
"index.auto_expand_replicas" : "0-all", | |
"index.number_of_replicas" : "0" |
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
#!/usr/bin/env bash | |
# https://github.com/elasticsearch/elasticsearch/issues/1357 | |
set -o verbose | |
curl -s -XGET http://localhost:9200/ |grep -B 1 number | |
curl -XDELETE http://localhost:9200/foo | |
curl -XPUT http://localhost:9200/foo -d '{ | |
"mappings": { |
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
<?xml version="1.0" encoding="UTF-8" ?> | |
<schema name="basecamp" version="1.3"> | |
<types> | |
<!-- indexed/stored verbatim --> | |
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/> | |
<!-- "true" or "false" --> | |
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/> | |
<!-- binary data, base64 --> |
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
# Dependencies: ruby, git, rubygems | |
sudo gem install bundler | |
git clone git://github.com/rails/rails.git | |
cd rails && gem bundle | |
ruby -rvendor/gems/environment railties/bin/rails ../new_app | |
cd ../new_app | |
# edit Gemfile to use: |
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
<table width="100%"> | |
<tr><td width="50%"> | |
{% compare_with_last_week_chart metric:'Custom/Objects/Allocated' title:'Object Allocations' value:total_value %} | |
</td><td width="50%"> | |
{% compare_with_last_week_chart metric:'Custom/Objects/Live' title:'Live Objects' value:average_value %} | |
</td></tr> | |
</table> |
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
# Configure generators to use sequel, haml, and shoulda. | |
config.generators do |g| | |
g.orm :sequel | |
g.template_engine :haml | |
g.test_framework :shoulda, :fixtures => true | |
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
# Round expiry to encourage HTTP caching. | |
# 5-minute expiry at 6:03 would round up from 6:08 to 6:10. | |
module QuantizedExpiry | |
def url_for(name, options = {}) | |
unless options[:expires] | |
t = (options.delete(:expires_in) || 5.minutes).to_i | |
options[:expires] = t * (2 + (Time.now.to_i / t)) | |
end | |
super | |
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
# Including a module included in a superclass is ignored | |
>> module Foo; end | |
=> nil | |
>> class Numeric; include Foo; end | |
=> Numeric | |
>> Float.ancestors | |
=> [Float, Precision, Numeric, Foo, Comparable, Object, Kernel] | |
>> class Float; include Foo; end | |
=> Float | |
>> Float.ancestors |