Skip to content

Instantly share code, notes, and snippets.

View nickhoffman's full-sized avatar

Nick Hoffman nickhoffman

  • Toronto, Canada
View GitHub Profile
@nickhoffman
nickhoffman / gist:3015881
Created June 29, 2012 05:01
ElasticSearch: Parent/Child: Find children based on parent properties
#!/bin/bash
# Reset the index.
curl -X DELETE "localhost:9200/test/?pretty=true"
curl -X PUT "localhost:9200/test/?pretty=true"
# Create the parent mapping.
echo
curl -X PUT "localhost:9200/test/user/_mapping?pretty=true" -d '{
"user": {
@nickhoffman
nickhoffman / Configure IRB's prompt for a Rails app
Last active December 15, 2015 09:49
Put each of these in ~/.irbrc
if defined? Rails
# Customize the IRB prompt.
short_env = case Rails.env
when 'development'
'dev'
when 'production'
'prod'
else
Rails.env
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
@nickhoffman
nickhoffman / run.rb
Last active April 15, 2016 19:09
Code Kata: string splitter
class String
def multiline_split(max_line_length)
self
end
end
puts "foo\nbar\nbaz" == "foo bar baz".multiline_split(3)
puts "foo bar\nbaz" == "foo bar baz".multiline_split(9)