View gist:579623b5d1f98a621cd8
This file contains 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
Chart | |
http://www.cpubenchmark.net/high_end_cpus.html | |
http://products.amd.com/en-us/DesktopCPUResult.aspx | |
http://ark.intel.com/ | |
http://ark.intel.com/compare/80814,80809,80808,80806,80807 | |
http://processors.findthebest.com/d/n/AMD |
View setup-statsd.sh
This file contains 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
# install git | |
sudo apt-get install g++ curl libssl-dev apache2-utils | |
sudo apt-get install git-core | |
# download the Node source, compile and install it | |
git clone https://github.com/joyent/node.git | |
cd node | |
./configure | |
make | |
sudo make install | |
# install the Node package manager for later use |
View DB stuff
This file contains 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
rails g scaffold user name:string | |
rails g scaffold prediction title:string | |
rails g scaffold position believes_it:boolean | |
rails g migration position_belongs_to_user | |
#class PositionBelongsToUser < ActiveRecord::Migration | |
# def self.up | |
# add_column :positions, :user_id, :integer | |
# end | |
# |
View changed_specs.rb
This file contains 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
RSpec::Core::RakeTask.new('spec:changed') do |t| | |
changed_files = `git status -s | grep '^ M spec/' | grep '_spec.rb$'`.split "\n" | |
changed_files.each {|file| file.sub! /\A M /, '' } | |
puts | |
puts "Found #{changed_files.count} changed spec file(s):" | |
changed_files.each {|file| puts " #{file}"} | |
puts |
View spreadsheet_importer.rb
This file contains 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
$ bundle exec rspec --fail-fast -b spec/models/spreadsheet_importer_spec.rb | |
No examples were matched by {:focus=>true}, running all | |
F | |
Failures: | |
1) SpreadsheetImporter instance variables has a reader for @catalog | |
Failure/Error: @importer = SpreadsheetImporter.new @catalog, @excel, @photos_dir | |
NoMethodError: | |
undefined method `each_pair' for #<Catalog:0xb0475bc> |
View app-controllers-sessions_controller.rb
This file contains 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 SessionsController < Devise::SessionsController | |
def create | |
if request.xhr? | |
resource = warden.authenticate! :scope => resource_name | |
if resource.nil? | |
render :json => { | |
:status => 'fail', | |
:data => { | |
:cause => 'invalid', |
View app-cells-product_have_cell.rb
This file contains 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 ProductHaveCell < Cell::Rails | |
def description(have) | |
condition = have.condition | |
desc = "#{have.quantity}x #{condition.name}" | |
if have.sealed | |
desc += ' ' + I18n.t('words.Sealed').downcase | |
elsif have.packaging | |
desc += ' ' + I18n.t('phrases.product_haves.with_packaging') | |
end |
View gist:1282105
This file contains 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
################### | |
# CREATE THE INDEX: | |
################### | |
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d ' | |
{ | |
"settings" : { | |
"analysis" : { | |
"filter" : { | |
"edge_ngram" : { | |
"side" : "front", |
View gist:1283380
This file contains 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
echo 'Delete the index.' | |
curl -X DELETE 'http://localhost:9200/test_products/?pretty=true' | |
echo; echo | |
echo 'Create the index. Copied directly from https://gist.github.com/961303 .' | |
curl -X PUT 'http://localhost:9200/test_products/?pretty=true' -d ' | |
{ | |
"settings" : { | |
"analysis" : { |
View gist:1284790
This file contains 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 -X GET 'localhost:9200/development_products/_search?pretty=true' -d ' | |
{ | |
explain: true, | |
query: { | |
dis_max: { | |
queries: [ | |
{ field: { "name": "grmlock" } }, | |
{ field: { "catalog.name": "grmlock" } }, | |
{ field: { "items.name": "grmlock" } }, | |
{ field: { "properties.character": "grmlock" } }, |
OlderNewer