Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
@lgs
lgs / gist:2869863
Created June 4, 2012 17:55
Tire.configure { @logger = Rails.logger} fails on Heroku
2012-06-04T17:49:00+00:00 app[run.1]: [IMPORT] Deleting index 'sb0cqngrfo2rp1hvw0kl'
2012-06-04T17:49:00+00:00 app[run.1]: rake aborted!
2012-06-04T17:49:00+00:00 app[run.1]: undefined method `log_request' for true:TrueClass
2012-06-04T17:49:00+00:00 app[run.1]:
2012-06-04T17:49:00+00:00 app[run.1]: Tasks: TOP => tire:import
2012-06-04T17:49:00+00:00 app[run.1]: (See full trace by running task with --trace)
2012-06-04T17:49:01+00:00 heroku[run.1]: Process exited with status 1
2012-06-04T17:49:01+00:00 heroku[run.1]: State changed from up to complete
2012-06-04T17:53:02+00:00 heroku[slugc]: Slug compilation started
@lgs
lgs / gist:2871366
Created June 4, 2012 23:01
reindex
2012-06-04T22:32:48+00:00 heroku[run.2]: State changed from created to starting
2012-06-04T22:32:55+00:00 heroku[run.2]: Starting process with command `bundle exec rake environment tire:import CLASS=Category FORCE=true`
2012-06-04T22:32:55+00:00 heroku[run.2]: State changed from starting to up
2012-06-04T22:33:18+00:00 app[run.2]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:19)
2012-06-04T22:33:18+00:00 app[run.2]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and con
lsoave@ubuntu:~/rails/github/gitwatcher$ cat Gemfile.lock
GIT
remote: git://github.com/rweng/jquery-datatables-rails.git
revision: 7e33c455fc12260109d59f478d3ec2edd2218b5e
specs:
jquery-datatables-rails (1.9.1.3)
jquery-rails
GIT
remote: git://github.com/sferik/rails_admin.git
@lgs
lgs / blog.gitwatcher.com
Created June 20, 2012 21:16
middleman Gemfile.lock for blog.gitwatcher.com
lsoave@ubuntu:~/rails/github/blog.gitwatcher.com$ cat Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
activesupport (3.2.6)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.8)
chunky_png (1.2.5)
coffee-script (2.2.0)
@lgs
lgs / gist:2974898
Created June 22, 2012 20:10 — forked from RaVbaker/gist:2967695
[HOWTO] Ubuntu 12.04 Ruby on Rails Development Environment

Ubuntu 12.04 Ruby on Rails Development Environment

I haven't set up an install guide for the latest ubuntu release, largely because the last set of instructions worked pretty closely with the latest and greatest Ubuntu, 12.04 Precise Pangolin, however when installing today, I found that there were enough differences in the way that I configure my setup to justify an update, so here it goes. Yes, I'm late to the party, but a quick google search didn't find anything that I felt was as complete for my requirements as my previous install guides, so here I go.

As always with my install guides, I have included here is just about everything you'll need (and then some) to get started with ruby on rails development with Ubuntu 12.04 as a platform. These are my settings and preferences, and this is certainly not the only way of doing things, so keep that in mind.

Step 1: Get the repos ready and run updates.

sudo apt-get update && sudo apt-get upgrade
@lgs
lgs / gist:3042501
Created July 3, 2012 19:51 — forked from djones/gist:2642094
Grape API being served with Goliath
#!/usr/bin/env ruby
# gem install grape --pre
# http://localhost:9000/hello.json
# => {"hello":"world"}
$:<< '../lib' << 'lib'
require 'goliath'
@lgs
lgs / Gemfile
Created July 4, 2012 19:00 — forked from smd686s/Gemfile
Goliath.io with Grape and MongoDB
gem 'mongo'
gem 'em-mongo'
gem 'bson_ext'
gem 'goliath'
gem 'grape'
Thanks Xavier, I too am a big fan of the style. It’s an honest capturing of what it’s like to learn this sort of thing for the first time (or in my case with fibers, the 10th).
Everything was clear up til the end, which is where the details get fuzzy for me.
If I could add in my $.02 to this final chunk:
class Surprise < Goliath::API
def response(env)
f = Fiber.current
EventMachine.add_timer 1, proc { f.resume }
@lgs
lgs / api.rb
Created July 6, 2012 17:00 — forked from gertig/api.rb
Snippets for an API with grape
# Server App
# This file must be in lib/myapp/api.rb
module MyApp
module Entities
class Products < Grape::Entity
expose :id, :code, :name, :short_description
expose :description, :unless => { :collection => true }
expose (:category) { |model, options| model.category.name }
expose (:brand) { |model, options| model.brand.name }
end
@lgs
lgs / api.rb
Created July 6, 2012 18:21 — forked from noahhendrix/api.rb
Authenticating with Grape
module Todo
class API < Grape::API
use Rack::Session::Cookie
version 'v1', :format => :json
helpers do
def current_user
return nil if env['rack.session'][:user_id].nil?
@current_user ||= User.get(env['rack.session'][:user_id])
end