Avdi Grimm open sources Quarto after self-publishing Confident Ruby #

If you’re thinking about self-publishing a technical book, you should take a look at Quarto, a Ruby-based toolchain for generating ebooks in EPUB, Mobi, and PDF formats.

Quarto is essentially a set of rake tasks backed by a Ruby library. You can check out the README for all the details, but here’s an excerpt about the tool’s flexibility:

Quarto doesn’t (yet) introduce any revolutionary ideas to e-publishing. Instead, it ties familiar tools together in a way that lets you write the way you want to.

There are a lot of tools that try to tie together an end-to-end publishing pipeline. But when you want to interpose your own processing in between steps, you’re out of luck. The fact that Quarto is structured as a set of Rake tasks means that you can add your own dependencies, your own steps, or tack extra processing onto any of the existing steps just by adding to your project’s Rakefile.

Buyer beware. We reached out to Avdi to see if he wanted us to say anything in particular about the project, he replied:

here’s a quote: “It’s a mess because I coded it in a frantic week” :-P

Ahh, I know the feeling all too well.

Is he just being humble or is Quarto not ready for prime time? Hey, it’s open source so you can be the judge!

If you’re curious about Confident Ruby, be sure to check out this blog post where he announces the book’s release as well as Quarto’s.

Share your thoughts and upvote on Hacker News.

#102: RVM and Managing Ruby versions with Michal Papis

Adam Stacoviak and Jerod Santo talk with Michal Papis about the history and future of RVM, the plan for RVM 2.0, the complexities of managing your Ruby version, Ruby 2.0 and more. SPONSOR: App Sketchbook – use the code “DANSENTME” to save $5.00 Subscribe to The Changelog Weekly! Michal Papis (mpapis) on Twitter mpapis (Michal […]

Super powered Jekyll templating with Jekyll Liquid Plus #

For those of you running a Jekyll or Octopress powered blog, Brandon Mathis has been working like crazy on Octopress 3.0, determining what it is and isn’t, and along the way breaking off pieces to release as independent gems.

His goal in doing this, is to allow Jekyll users to be able to install a few gems and be able to use most of Octopress’s goodies without having to change a thing.

Yesterday, he announced Jekyll Liquid Plus.

Jekyll Liquid Plus includes:

  • Redesigned, but backwards compatible: include, assign and capture tags
  • All new: render, wrap, wrap_include and return tags

From this Alpha post from Brandon:

My goal for Octopress is to be a writer-focused usability layer on top of Jekyll and a cohesive framework for building themes and plugins. Octopress will work alongside Jekyll without getting in the way at all. It’s shaping up nicely.

Is it safe to say that Octopress 3.0 is coming soon? Many are waiting with baited breath. My guess is that with this and the other independent gems Brandon has released, he is getting close.

Check out the source for Jekyll Liquid Plus on GitHub.

Subscribe to Weekly to hear about more projects from Brandon.

Remote pairing in the browser? Pssh! #

Full disclosure: I am the creator and owner of Portly. Pssh works with or without Portly. But, without Portly, adding a local tunnel to your machine can be a pain.


If you’re a fan of episode #90 on pair programming with Avdi Grimm, you know that pairing can be an invaluable tool for debugging, learning, and just overall better code. Unfortunately, remote pairing generally gets less enthusiasm since there’s such a learning curve to the setup, and it tends to feel inconvenient.

Portly has launched a new tool called Pssh that makes remote pairing simple with just a gem and a browser. Install Pssh and run it either inside your tmux/screen session or from a vanilla shell, and your buddies can remote pair with you from their browser.

> gem install pssh
> pssh

If Pssh is started inside a tmux or screen session, it boots up its own console for you to manage users. If started from a plain shell, it behaves just like you opened a fresh console and kills Pssh when you exit.

Paired with the native Mac app from Portly, you can share a url to your session and lock it down with HTTP Authentication. Open up another browser tab to check out the changes to the local website you’re working on in real-time.

Check out the homepage, the readme or the source on GitHub to learn more about Pssh and how it works.

Share your thoughts and comments on Hacker News.

A startup template for Ruby on Rails 4 applications #

Way back in January, I wrote a blog post called “Rails has two default stacks”. In it, I discussed how people like to customize the defaults that Ruby on Rails gives you. Your company might prefer Postgres/HAML/RSpec, for example, over the default MySQL/ERB/MiniTest.

There’s an under-used feature of Rails that allows you to automate the creation of your own stack: templates. Check it:

$ rails --help
Usage:

  rails new APP_PATH [options]

Options:

-r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                               # Default: /opt/rubies/ruby-2.0.0-p195/bin/ruby
-m, [--template=TEMPLATE]      # Path to some application template (can be a filesystem path or URL)

Application template? Yep. There’s very little documentation on this feature, unfortunately. There is a work in progress Rails Guide that gives some answers, but it’s not done yet.

Anyway, the TL;DR is this: you can write a little script to help initialize a Rails app just the way you want to. And Rails startup template is exactly that.

Here’s some of the things it gives you out of the box:

  1. Adds analytics-ruby, simple_form, uuidtools, rspec, guard-rspec, and bourbon gems, as well as a few more.
  2. Creates a new git repository, and optionally a new one on GitHub
  3. Sets up foreman for easy environment variable and background service config.
  4. Removes include_tree . from your application.css, since the author prefers to require things manually.

There are some other features, as well.

Check it out on GitHub and vote it up on Hacker News.

Renewed efforts to translate the Ruby Hacking Guide into English #

Vincent Isambart, a French Rubyist living in the land of the rising sun (Tokyo, Japan), and a few others have started a new organization on GitHub to renew the efforts to help translate the Ruby Hacking Guide (originally written in Japanese by Minero AOKI) into English.

The Ruby Hacking Guide is a book that explains how the ruby interpreter (the official C implementation of the Ruby language) works internally.

If you’d like to help…

People who are good at Ruby, C and Japanese or English are needed. Those good at Japanese (native Japanese speakers are of course welcome) can help translate and those good at English (preferably native speakers) can help correct mistakes, and rewrite badly written parts… Knowing Ruby and C well is really a requirement because it helps avoiding many mistranslations and misinterpretations.

Interested parties can join in by forking this repo to get started. There’s also a mailing list to introduce yourself — mention who you are, your skills, and how much free time you have.

For those wanting to read what’s been translated so far, check out the public version online.

Have an opinion? Discuss it on Hacker News.

ht/ Hiro Asari via Steve Klabnik.

#97: API wrappers, Ruby and open source with Drew Blas

Adam Stacoviak and Andrew Thorp talk with Drew Blas of Chargify about API wrappers, Ruby, open source, and more. You can tune-in LIVE on Tuesday’s at 5pm CST. Drew Blas – Explorer « The life and code of a passionate developer drewblas (Drew Blas) on GitHub drewblas (drewblas) on Twitter drewblas/consignment chargify (Chargify) chargify/chargify2 chargify/doculab

#96: Ruby off Rails with Jesse Wolgamott

Adam Stacoviak and guest co-host Tim Smith talk with Jesse Wolgamott about learning Ruby, his course and mentorship Ruby off Rails, and more! You can tune-in LIVE on Tuesday’s at 5pm CST. J.Wo Ruby Off Rails | Online Ruby Course full of mentoring and collaboration. jwo (Jesse Wolgamott) Comal Productions | web. mobile. training. code […]

#94: Sass, libsass, Haml and more with Hampton Catlin

Adam Stacoviak and Andrew Thorp talk with Hampton Catlin about Sass, libsass, Haml, Tritium, Moovweb and more. You can tune-in LIVE on Tuesday’s at 5pm CST. hcatlin/libsass Tritium from Moovweb, the web transformation platform Moovweb Sass – Syntactically Awesome Stylesheets The Sass Way The Sass Jerk – Articles Getting started with Sass and Compass – […]

When it comes to backups, this gem has it all #

Backup, a tool written by Michael van Rooijen , has provided me so much value over the years that it’d be a shame not to give it some Changelog love.

Backup is a system utility for Linux and OS X which allows you to easily model your backup system using a nice Ruby DSL. The greatest thing about Backup, aside from the fact that it Just Works, is that it has built-in support for just about anything you would want to do.

It handles compression, encryption, cloud storage, splitting, syncing, notifications, logging, and on, and on.

With all that functionality, you might expect Backup to be overwhelming to get started with. Not so. It also has nifty generators which spit out documented model code so you can learn and tweak as you need. If that’s not enough, there is a Getting Started page and a very useful wiki which explains, in detail, all of the subsystems.

Backup is MIT licensed and hosted on GitHub.

Love Rubular? Here are a few open source copycats to checkout.

Rubular is awesome for working with regexes and testing things out. It’s fast, simple, and allows you to write/test/debug regexes super quick. The bummer is that it’s not open source, so taking a peek under the hood to learn how its built isn’t possible. (insert sad face) Here are two options on GitHub that claim […]

#92: Sidekiq, Ruby, and more with Mike Perham

Adam Stacoviak and Andrew Thorp talk with Mike Perham about sustaining open source, sidekiq, message processing with Ruby, and more. You can tune-in LIVE on Tuesday’s at 5pm CST. mperham (Mike Perham) mperham/sidekiq · GitHub mperham/dalli · GitHub mperham/lunchy · GitHub mperham/girl_friday · GitHub The Clymb | The Gear You Need. Up To 70% Below […]

Create beautiful JavaScript charts with one line of Ruby using Chartkick #

So many web apps need to visualize data for their users that a high quality charting library is a huge boon for developers. Andrew Kane’s Chartkick might be just the library for Ruby developers.

Chartkick sample

Chartkick works with Rails 3.1+ and makes adding beautiful charts to your web app as easy as a one liner. Create a simple line chart like this:

<%= line_chart User.group_by_day(:created_at).count %>

Or one with multiple series of data like this:

<%= line_chart @goals.map { |goal| 
  {
    :name => goal.name, 
    :data => goal.feats.group_by_week(:created_at).count 
  } 
} %>

A pie chart is as easy as:

<%= pie_chart Goal.group("name").count %>

Chartkick is mostly a JavaScript library with Ruby helpers to generate the required markup that the JavaScript turns into charts. It requires either Google Charts or Highcharts to work, but it doesn’t require Ruby! If you want to use the JavaScript bits from another language, check out Chartkick.js instead.

Chartkick is MIT licensed and hosted on GitHub.

#90: Pair programming and Ruby with Avdi Grimm

Adam Stacoviak, Andrew Thorp and fellow changelogger Steve Klabnik talk about pair programming, distributed teams, workflows, Ruby and more with Avdi Grimm. You can tune-in LIVE on Tuesday’s at 5pm CST. Avdi Grimm (avdi) on Twitter Pair Program With Me Wide Teams | The blog for geographically dispersed organizations Ruby Rogues (podcast) Ruby Tapas | […]

Earn a Sidekiq blackbelt by breaking a few boards

Wynn posted about Sidekiq last February, briefly introducing a new way of handling background workers. For those of us who took on the challenge of switching from Resque to Sidekiq, you can probably agree with me that it brought a new set of challenges to tackle. The upside of that, though, is that tackling those […]

Stringer: a self-hosted, anti-social RSS reader #

With July 1st’s closing of Google Reader looming ever closer, the open source community has risen to the challenge of providing viable alternatives to the popular feed reading service.

Stringer is Matt Swanson’s entry into the RSS ecosystem. Matt describes Stringer like so:

Stringer has no external dependencies, no social recommendations/sharing, and no fancy machine learning algorithms. But it does have keyboard shortcuts and was made with love! When BIG_FREE_READER shuts down, your instance of Stringer will still be kicking.

Here’s a screenshot of it in action. (Bonus points for featuring a Changelog post!)

Stringer is written in Ruby and built on Sinatra with a PostgreSQL datastore. It deploys easily to Heroku and is a self-professed work-in-progress. One thing the web app currently lacks is a solid mobile offering, so please get involved if you have mobile ideas and/or chops!

The project is MIT licensed and hosted on GitHub.

Run Ruby in the browser with Decaf, a fork of WebKit. #

Decaf, from Tim Mahoney is a fork of WebKit that allows you to run Ruby in the browser. A simple example from the README:

<script type='text/ruby'>
  window.onload do
    introduction = document.create_element('p')
    introduction.inner_text = 'Hello, world!'
    document.body.append_child(introduction)
  end
</script>

It only works on the Mac right now, and there are a few other gotcha’s to keep in mind:

  • In Ruby, methods and attributes are specified in underscore_case instead of camelCase.
  • The window variable is accessible from only the top-most scope. Elsewhere you can use the global $window.
  • Ruby accepts Procs and blocks as callbacks and listeners. View an example.

You can go to the project homepage, get the latest release or view the source on GitHub.

Xray-rails reveals which files are being rendered in your view #

When I pair with Railsbridge attendees or new developers, I often wish I had a visual way to let them see the connection between the files in the codebase and what’s rendered in the browser. Today Ruby 5 featured Xray and a number of friends contacted me about checking it out. In no time I knew I’d found the solution.

I gave it a test drive on one of the student apps and it took 5 minutes, at most, to get up and running.

Just drop this in your Gemfile:

group :development do
  gem 'xray-rails'
end

Bundle and delete the cached assets:

$ bundle && rm -rf tmp/cache/assets

Restart your app, visit it in your browser, and press cmd+shift+x

xray-rails

By far the best feature in Xray is the fact that it allows you to actually click on the overlay and go straight to the file or partial being rendered. It defaults to Sublime, which is easy for new users, but is simple enough to customize to another tool for seasoned pros.

Xray is great for:

  • Helping new Rails developers while pairing to get clearer understanding of views
  • Gaining quick insight into complex views
  • Debugging templates, partials, and backbone views

See Xray in action

Right now Xray is a tool for the Rails framework but there are plans to expand and make it available for any framework. You can check it out on Github.

#86: Discourse, Ruby and more with Jeff Atwood (aka Coding Horror)

Adam Stacoviak, Andrew Thorp and Kenneth Reitz talk with Jeff Atwood about Discourse and more. Tune in LIVE every Tuesday at 3pm PT / 6pm ET. We’re live every Tuesday! thechangelog.com/live Hack in style with your very own Changelog tee! We are now member supported! We’re joined by Jeff Atwood, from codinghorror.com and stackexchange.com Stack […]

Bring your server side debug logging into the browser with Chrome Logger #

If you find yourself jumping back and forth between Chrome’s Dev Tools and a terminal displaying your server side request logs, Craig Campbell’s Chrome Logger might be just the thing you need!

It’s a Chrome extension which lets you see your server side logs right in the browser. There are currently libraries for:

Is your server side language/environment of choice not on that list? Don’t worry, Chrome Logger uses an open and published protocol so you can easily write client libraries of your own!

See the project’s home page for more info or check under the hood if you’re curious about how it all works.

Hyperresource: a hypermedia API client for Ruby #

Any of you who know me aren’t surprised about me posting this story: it’s right up my alley!

Basically, hyperresource is intended to be a general hypermedia client. What’s that mean? It can work with any API that happens to use one of the media types it supports. Right now, that’s just HAL+JSON, but more will be added in the future.

What’s that mean in terms of code? Well, here’s an example from the README:

api = HyperResource.new(root: 'https://api.example.com')
# => #<HyperResource:0xABCD1234 @root="https://api.example.com" @href="" @namespace=nil ... >
root = api.get
# => #<HyperResource:0xABCD1234 @root="https://api.example.com" @href="" @namespace=nil ... >
root.response_body
# => { 'message' => 'Welcome to the Example.com API',
#      'version' => 1,
#      '_links' => {
#        'self' => {'href' => '/'},
#        'users' => {'href' => '/users{?email,last_name}', 'templated' => true},
#        'forums' => {'href' => '/forums{?title}', 'templated' => true}
#      }
#    }
jdoe_user = api.users.where(email: "jdoe@example.com").first
# => #<HyperResource:0x12312312 ...>

How does it know how to look up those users? Well, there’s a users link relation on in the response, and it has a templated URI as its href attribute. This lets the client reflect and know how to look up users by their email or last name.

The power of this generic tooling is that we no longer have to think about how to parse HAL, how to interpret the response… we have this one library which works with any HAL-powered API.

The biggest drawback of hyperresource is that it’s read-only at the moment, nothing but GET. But it shows a lot of promise, and I’m excited to see this kind of stuff pop up in the wild. Everything I see points to 2013 as the year of example code for hypermedia services.

Check it out on GitHub.

csscss parses your CSS and shows your duplicated declarations #

Yesterday, a neat little gem called csscss celebrated a 1.0 release!

csscss will parse any CSS or Sass file you give it and let you know which rulesets have duplicated declarations.

It’s super easy to use:

$ gem install csscss
$ csscss path/to/styles.css path/to/other-styles.css

{.contact .content .primary} and {article, #comments} share 5 rules
{.profile-picture}, {.screenshot img} and {a.blurb img} share 4 rules
{.work h2:first-child, .archive h2:first-child, .missing h2:first-child, .about h2, .contact h2} and {body.home h2} share 4 rules
{article.blurb:hover} and {article:hover} share 3 rules

Cool! This really helps when you’re trying to get a handle on refactoring. Maybe it’s just me, but I find remembering all of my CSS rules very complicated. There’s a reason I’m more of a back-end developer…

For those who write their CSS in Sass, csscss can also parse Sass files, as well. Just point it at one and it’ll go to town!

Check out the homepage or the source on GitHub for more details.


There’s one other neat part about this gem, but it’s not for users of the gem — it’s for developers. csscss contains, as you’d expect, a full CSS parser written in parselet. I’m sure that others could do need static analysis stuff with CSS if they had a parser that was pre-built for them, as well.

Write Ruby API’s with Stripe’s Poncho (a DSL for REST interfaces) #

As we said in a previous post: WE LOVE STRIPE!

The team at Stripe has open sourced a RubyGem that makes REST API’s easy to create, Poncho. It’s compatible with any rack-based framework — like Rails or Sinatra. Best of all, it has a slew of (simple to use) features:

Installation is simple, just install the poncho gem (or add gem poncho to your Gemfile). After installation, you can setup your API:

class ChargeResource < Poncho::Resource
  param :amount, :type => :integer
end

class ChargeCreateMethod < Poncho::JSONMethod
  param :amount, :type => :integer, :required => true

  def invoke
    charge = Charge.new
    charge.amount = param(:amount)
    charge.save

    ChargeResource.new(charge)
  end
end

post '/charges', &ChargeCreateMethod

The above code, which was pulled from the documentation is using Sinatra, but you could easily swap Rails out:

match '/charges' => ChargeCreateMethod, :via => :post

The documentation is thorough, and does a great job at explaining how to use Poncho. You can also view the source or discuss this on HackerNews.

Helios: a server side for your iOS app #

Today, the always-impressive Mattt released a new project: Helios.

Helios is an open-source framework that provides essential backend services for iOS apps, from data synchronization and user accounts to push notifications, in-app purchases, and passbook integration. It allows developers to get a client-server app up-and-running in just a few minutes, and seamlessly incorporate functionality as necessary.

Getting started is easy:

$ gem install helios
$ helios new myapp
$ cd myapp; helios server
$ open http://localhost:5000/admin

Helios is broken down into useful components, too. If you check out the .gemspec, you’ll notice a few other gems that would be useful for anyone trying to build a backend service.

There’s a lot of startups that do “Backend as a Service,” such as Parse, so it’s nice to see an OSS competitor pop up.