background preloader

Ruby

Facebook Twitter

Working with Angular.js and Rails. If you put me in a corner today and ask me to build a project I would choose Rails + Angular.js.

Working with Angular.js and Rails

It is just an awesome combination to build clean apps quickly. However, a few of my friends have lately asked me how to properly setup Angular.js with Rails. One way is the standard Yeoman / Grunt way which is awesome and creates a nice minified build for you but how do you integrate it with Rails cleanly? Another way is to use the Rails asset pipeline which works well but causes problems when you are using require.js among other stuff. I find the Yeoman Angular generator really awesome, it generates the skeleton code for an Angular.js project and a great Grunt file which has livereload, cssmin, htmlmin, imagemin etc. working out of the box. So, how could one use Rails with the Yeoman generated Angular project without tearing one's hair out.

Angular + Rails + Yeoman = Angrailman? Lots o’ fun new tools running around the JavaScript ecosystem right now (Angular, Ember, Backbone, etc…) Only trouble is that the relative immaturity of this space means high costs for new developers trying to navigate the thicket of options for testing, build, workflow, and other development things.

Angular + Rails + Yeoman = Angrailman?

I’m not going to wade into the debate around which client side JS framework is the “best”. However, for those of you who like AngularJS on the frontend and Rails on the backend, this post is for you. The basic idea is of course to use Rails as the API backend for persistence, session, etc., Under this scenario, it will also serve up the application code as a static asset from the /public directory rather than having your frontend code served from a Rails controller or have your assets compiled using the asset pipeline. The reason for this is that I use Yeoman for client side dependency management, building, testing, and workflow management. Prerequisites. Warbler-1.3.6 Documentation. Warbler is a gem to make a Java jar or war file out of any Ruby, Rails, Merb, or Rack application.

warbler-1.3.6 Documentation

Warbler provides a minimal, flexible, Ruby-like way to bundle up all of your application files for deployment to a Java environment. Warbler provides a sane set of out-of-the box defaults that should allow most Ruby applications to assemble and Just Work. Getting Started Install the gem: gem install warbler.Run warbler in the top directory of your application: warble. Rubinius : Use Ruby™ RubyMotion - Ruby for iOS and OS X.

7 Patterns to Refactor Fat ActiveRecord Models. When teams use Code Climate to improve the quality of their Rails applications, they learn to break the habit of allowing models to get fat.

7 Patterns to Refactor Fat ActiveRecord Models

“Fat models” cause maintenance issues in large apps. Only incrementally better than cluttering controllers with domain logic, they usually represent a failure to apply the Single Responsibility Principle (SRP). Custom Ruby Gem in Gemfile on Heroku. Using Google geocoding API from Heroku application. Package <span class="skimlinks-unlinked">com.llamarycomer.maps</span>; import flexjson.JSONDeserializer; import <span class="skimlinks-unlinked">org.apache.log4j.Logger</span>;

Using Google geocoding API from Heroku application

#381 jQuery File Upload (pro) Josevalim/inherited_resources. Ruby on Rails & AngularJS: Resources. I’m a huge fan of AngularJS and an even bigger fan of Ruby on Rails.

Ruby on Rails & AngularJS: Resources

However, one of the gripes I have with AngularJS is the fact it lacks great documentation. Stuff seems scattered, especially when it comes to the magical ‘Resource’ module. To test the feasibility of AngularJS when using Rails I created a simple project to demonstrate an all AngularJS front-end communicating to a Rails back-end via the Resource module. The following write up starts with setting up Rails and moves into setting up Angular later. Source and Live Demo You can find the entire project here on Github and the live demonstration of the project here on Heroku . Laserlemon/figaro. Seyhunak/twitter-bootstrap-rails. HTTP Cheat Sheet. By Peter Cooper / January 16, 2010 Norwegian Rubyist August Lilleaas has been busy putting together a ton of examples of using the Net::HTTP Ruby library that comes with most Ruby distributions.

I asked him if it'd be okay to put some of them directly on Ruby Inside for reference purposes and he said "No problem! " It's worth noting that Net::HTTP has been superseded in many areas by libraries like John Nunemaker's HTTParty and Paul DIx's high performance Typhoeus, but as part of the standard library, Net::HTTP is still a popular option though it doesn't have the easiest API to remember. Here's a selection of August's examples for some of the most common operations.

Want to see all of the examples and follow any updates made to them? The pain of JSON API testing. I’m a little behind on my blog feeds, so I didn’t read Collective Idea’s article about json_spec until yesterday.

The pain of JSON API testing

They created a gem which provides some RSpec matchers and Cucumber steps to do JSON API testing, since “They can be a joy to build but a pain to test”. In this article, I want to take a step back and see exactly how painful it is to test a JSON API. Since I don’t agree that testing an API with Cucumber is a good idea, we’ll do it in plain RSpec. I’ll get back on that at the end of this article. RVM: Ruby Version Manager - RVM Ruby Version Manager - Documentation. Sinatra. Learn Web Development with the Ruby on Rails Tutorial. Ruby on Rails Screencasts - RailsCasts. How to write a Ruby and Rails 3 REST API. Background I’ve always wondered how I’d go about publishing a real REST API on the web to do something.

How to write a Ruby and Rails 3 REST API

In this example, we’ll create an employee manager app-thing. It’s not particularly interesting but it shows what “API” means. Intridea/grape. The Grapes of Rapid (RubyConf 2010) Www.jstatsoft.org/v29/i04/paper. Data Visualisation with Ruby - Chris Lowis - Ruby Manor. There aren't many native data visualisation tools for Ruby. Chris has had a good look round to see what the options are for visualising data in Ruby, and he's put quite a few examples on github . Scruffy is pretty much the best native Ruby plotting library. It generates SVG graphs, and does basic functional plotting. There hasn't been much recent activity, and it doesn't let you do much data analysis. So what are the alternatives?

Google Charts.