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 Google | |
def self.geocode(address) | |
puts "address: #{address}" | |
@resp = client.get do |req| | |
req.url 'geocode/json' | |
req.params[:address] = address | |
req.params[:sensor] = false | |
end | |
@address = @resp.body['results'].first | |
{ |
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
Bundler could not find compatible versions for gem "money": | |
In Gemfile: | |
spree_stock_email (>= 0) ruby depends on | |
money (< 6.0.0) ruby | |
spree_stock_email (>= 0) ruby depends on | |
money (6.0.0) |
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
def foo | |
puts 'bar' | |
end | |
puts 'test' | |
foo |
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
rake spree_auth:admin:create --trace | |
----- | |
Create the admin user (press enter for defaults). | |
Email [[email protected]]: | |
Password [spree123]: | |
There was some problems with persisting new admin user: | |
Email can't be blank | |
Email can't be blank |
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
Updating activeadmin | |
ERROR: While executing gem ... (Gem::ImpossibleDependenciesError) | |
rails-4.0.0 requires activerecord (= 4.0.0) but it conflicted: | |
Activated activerecord-4.0.0 instead of (~> 3.1) via: | |
meta_search-1.1.3, activeadmin-0.6.0 |
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
module Porter | |
class Locu | |
# http://dev.locu.com/documentation/ | |
DEFAULTS = {api_key: ENV['LOCU']} | |
class << self | |
%w(venue menu_item).each do |section| | |
define_method :"#{section}_search", ->(params = {}){ get("#{section}/search/", params) } | |
define_method :"#{section}_insight", ->(params = {}){ get("#{section}/insight/", params) } | |
define_method :"#{section}_info", ->(id){ get("#{section}/#{id}/") } |
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
Scaffold is nice, but as you move forward you'll find yourself customizing too much. Use slim for markup, sass for styling, and coffeescript for behavior. There's niceities like inherited_resources for defining the default crud in a controller, and are usually even faster to develop with. The greatest thing about ruby on rails is how easy it is to write tests. Its a core convention of the framework. From my (limited) python experience, I have not seen such an adherence to test or the ease to do so. |
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
request = require 'request' | |
keys = require('../config/keys.json')[process.env.NODE_ENV|| 'development'] | |
exports.nearby = (options, callback)-> | |
params = | |
term: options.query | |
offset: options.offset | |
ll: "#{options.lat},#{options.lng}" | |
console.log keys.yelp |
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
// Lovely simple-to-read code: | |
function handleDelete(request, response) { | |
getBlogByGuid(request.url.query.guid, function gotBlog(err, blog) { | |
deleteDocumentById(blog.id, function deletedBlog(err, status) { | |
// Deleted OK | |
response.writeHead(200); | |
response.end('Blog Deleted'); | |
}) | |
}); |
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.application.assets.logger = Logger.new('/dev/null') | |
Rails::Rack::Logger.class_eval do | |
def call_with_quiet_assets(env) | |
previous_level = Rails.logger.level | |
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 | |
call_without_quiet_assets(env).tap do | |
Rails.logger.level = previous_level | |
end | |
end | |
alias_method_chain :call, :quiet_assets |