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
gem("rspec-rails", :group => "test") | |
gem("cucumber-rails", :group => "test") | |
gem("spine-rails") | |
gem("eco") | |
gem("mongoid") | |
if yes?("Would you like to install Devise?") | |
gem("devise") | |
generate("devise:install") | |
model_name = ask("What would you like the user model to be called? [user]") |
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
require 'socket' | |
def local_ip | |
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily | |
UDPSocket.open do |s| | |
s.connect '64.233.187.99', 1 | |
s.addr.last | |
end | |
ensure | |
Socket.do_not_reverse_lookup = orig |
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
f = File.open("./Mini-SurveyWhatMVFrameworkDoYouUseAndWhy.csv") | |
framework_pros = {"Angular" => [], "Backbone" => [], "Ember" => []} | |
framework_cons = {"Angular" => [], "Backbone" => [], "Ember" => []} | |
f.readlines.each do |l| | |
row = l.split(";") | |
if row[0].match(/Angu|angu/) | |
framework_pros["Angular"] << row[1] | |
framework_cons["Angular"] << row[2] | |
elsif row[0].match(/Back/) | |
framework_pros["Backbone"] << row[1] |
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
require 'spec_helper' | |
require 'vcr' | |
require 'fakeweb' | |
require 'pry' | |
VCR.configure do |c| | |
c.cassette_library_dir = 'fixtures/vcr_cassettes' | |
c.hook_into :fakeweb | |
end |
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
.content { | |
width: 600px; | |
margin: 0 auto 0; | |
margin-bottom: 0; | |
} | |
.sidebar { | |
position: fixed; | |
left: 15px; |
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
-rw-r--r-- 1 root root 2067 Mar 11 11:37 install_rvm.log | |
-rw-r--r-- 1 root root 1349 Mar 11 11:37 install_rvm_requirements.log | |
-rw-r--r-- 1 root root 302 Mar 11 11:37 uninstall_ruby-1.9.3-p374.log | |
-rw-r--r-- 1 root root 3742 Mar 11 11:39 install_ruby-1.9.3-p374.log | |
-rw-r--r-- 1 root root 850 Mar 11 11:39 package_ruby-1.9.3-p374.log | |
-rw-r--r-- 1 root root 300 Mar 11 11:39 uninstall_ruby-2.0.0-rc1.log | |
-rw-r--r-- 1 root root 3779 Mar 11 11:43 install_ruby-2.0.0-rc1.log | |
-rw-r--r-- 1 root root 845 Mar 11 11:43 package_ruby-2.0.0-rc1.log |
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 Chef::Resource::Script | |
def log_code command | |
if Chef::Config[:log_level] == :debug | |
code "{ #{command}; _ret=$?; echo \"Exit status was $_ret.\"; exit $_ret; } 2>&1 | | |
tee /var/log/#{@command.to_s.gsub(/ /,"_")}.log; exit ${PIPESTATUS[0]}" | |
else | |
code command | |
end | |
end | |
end |
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
# Index | |
--------------------------------------------------------------------- | |
curl -XPUT http://localhost:9200/pictures/ -d ' | |
{ | |
"settings": { | |
"analysis": { | |
"analyzer": { | |
"index_analyzer": { | |
"tokenizer": "standard", |
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
server = Stretcher::Server.new('http://localhost:9200', :log_level => :debug) | |
server.index(:moviesdb1).create(mappings: {movie: {properties: {title: {type: 'string'}, genres: {type: 'string', index_name: 'genre1'}}}}) | |
# [Stretcher][DEBUG]: curl -XPUT http://localhost:9200/moviesdb1 -d '{"mappings":{"movie":{"properties":{"title":{"type":"string"},"genres":{"type":"string","index_name":"genre1"}}}}}' '-H Accept: application/json' '-H Content-Type: application/json' '-H User-Agent: Stretcher Ruby Gem 1.20.0.beta1' | |
# => #<Hashie::Mash acknowledged=true ok=true> | |
server.index(:moviesdb1).type(:movie).put(1, { title: 'The Artist', genres: ['Drama', 'Comedy']}) | |
server.index(:moviesdb1).type(:movie).put(2, { title: 'Taxi Driver', genres: ['Drama', 'Action']}) |
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
function createUser(raw, success_cb, fail_cb) { | |
var userId; | |
console.log("enter"); | |
async.waterfall([ | |
function(cb) { | |
// Increase | |
client.hincrby('users', 'count', 1, cb); |