Ruby

  • Most Topular Stories

  • Optimizing Webfont Selection and Synthesis

    RubyFlow
    16 Sep 2014 | 9:55 am
    How many font variants is your site using? Do you need all of them, and could you rely on the browser to generate some on your behalf? A look under the hood of how font selection and synthesis works in the browser.
  • A lightweight way to handle different validation situations

    RubyFlow
    16 Sep 2014 | 8:17 am
    Say you have an Article model, and it could be either a draft or a published article. The published article needs more validation than the draft. What’s the best way to write this? Rails has a lightly documented, little-known feature that makes these problems really easy to handle.
  • Getting Started with Polymer in Ruby on Rails

    Josh Huckabee
    jhuckabee
    9 Sep 2014 | 8:16 am
    Polymer is a polyfill framework for the upcoming Web Components standards. Web Components is a set of new standards that encompass Shadow DOM, Custom Elements, and HTML Imports. Together, these standards make it easy to extend the nature of the web by creating a reusable set of widgets similar to the ones already provided by standard HTML elements. At the time of this writing, there are 3 ongoing efforts to integrate Polymer with Ruby on Rails. They are: nevir/polymer-rails alchapone/polymer-rails ahuth/emcee All three of these projects have a similar approach. They integrate with Sprockets…
  • Embedding Structs in Go

    techno weenie
    rick
    28 Aug 2013 | 5:00 pm
    I've been toying with Go off and on for the last few months. I'm finally at a point where I'm using it in a real project at GitHub, so I've been exploring it in more detail. Yesterday I saw some duplicated code that could benefit from class inheritance. This isn't Ruby, so I eventually figured out that Go calls this "embedding." This is something I missed from my first run through the Effective Go book. Let's start with a basic struct that serves as the super class. type SuperStruct struct PublicField string privateField string func s SuperStruct Foo fmtPrintlnsPublicField sprivateField It's…
  • Go interfaces communicate intent

    techno weenie
    rick
    3 Sep 2014 | 5:00 pm
    Interfaces are one of my favorite features of Go. When used properly in arguments, they tell you what a function is going to do with your object. // from io func Copy(dst Writer, src Reader) (written int64, err error) Right away, you know Copy() is going to call dst.Write() and src.Read(). Interfaces in return types tell you what you can and should do with the object. // from os/exec func (c *Cmd) StdoutPipe() (io.ReadCloser, error) { It's unclear what type of object StdoutPipe() is returning, but I do know that I can read it. Since it also implements io.Closer, I know that I should probably…
  • add this feed to my.Alltop

    RubyFlow

  • Download Sinatra Cookbook now

    17 Sep 2014 | 4:24 am
    Today I am announcing the first 8 chapters of Sinatra Cookbook, and to celebrate here's 15% off for you all. https://www.softcover.io/buy/27309ccd/sinatra_cookbook?code=rubyflow
  • Optimizing Webfont Selection and Synthesis

    16 Sep 2014 | 9:55 am
    How many font variants is your site using? Do you need all of them, and could you rely on the browser to generate some on your behalf? A look under the hood of how font selection and synthesis works in the browser.
  • A lightweight way to handle different validation situations

    16 Sep 2014 | 8:17 am
    Say you have an Article model, and it could be either a draft or a published article. The published article needs more validation than the draft. What’s the best way to write this? Rails has a lightly documented, little-known feature that makes these problems really easy to handle.
  • From Rails 3.2 to 4.2

    16 Sep 2014 | 6:19 am
    Lessons learned from upgrading a small service application from Rails 3.2 to 4.2.
  • ActiveRecord count vs length vs size and what will happen if you use it the way you shouldn’t

    15 Sep 2014 | 12:55 pm
    One of the most common and most cumbersome errors you can make: using length instead of count. You can repeat this multiple times, but you will always find someone who’ll use it the way it shouldn’t be used. Here as a reminder: ActiveRecord count vs length vs size and what will happen if you use it the way you shouldn’t
 
  • add this feed to my.Alltop

    techno weenie

  • Go interfaces communicate intent

    rick
    3 Sep 2014 | 5:00 pm
    Interfaces are one of my favorite features of Go. When used properly in arguments, they tell you what a function is going to do with your object. // from io func Copy(dst Writer, src Reader) (written int64, err error) Right away, you know Copy() is going to call dst.Write() and src.Read(). Interfaces in return types tell you what you can and should do with the object. // from os/exec func (c *Cmd) StdoutPipe() (io.ReadCloser, error) { It's unclear what type of object StdoutPipe() is returning, but I do know that I can read it. Since it also implements io.Closer, I know that I should probably…
  • Weather Lights

    rick
    31 Aug 2014 | 5:00 pm
    I recently spoke at the GitHub Patchwork event in Boulder last month. My son Nathan tagged along to get his first taste of the GitHub Flow. I don't necessarily want him to be a programmer, but I do push him to learn a little to augment his interest in meteorology and astronomy. The night was a success. He made it through the tutorial with only one complaint: the Patchwork credit went to my wife, who had created a GitHub login that night. Since then, I've been looking for a project to continue his progress. I settled on a weather light, which consists of a ruby script that changes the color of…
  • Key/value logs in Go

    rick
    1 Nov 2013 | 5:00 pm
    I shipped GitHub's first user-facing Go app a month ago: the Releases API upload endpoint. It's a really simple, low traffic service to dip our toes in the Go waters. Before I could even think about shipping it though, I had to answer these questions: How can I deploy a Go app? Will it be fast enough? Will I have any visibility into it? The first two questions are simple enough. I worked with some Ops people on getting Go support in our Boxen and Puppet recipes. Considering how much time this app would spend in network requests, I knew that raw execution speed wasn't going to be a factor. To…
  • One HTTP Handler to rule them all

    rick
    20 Oct 2013 | 5:00 pm
    Justinas Stankevičius wrote a post about writing HTTP middleware in Go. Having seen how Rack changed the Ruby web framework landscape, I'm glad Go has simple HTTP server interfaces baked in. GitHub itself runs as a set of about 15 Rack middleware (depending on the exact environment that it boots in). They are setup in a nice declarative format: # GitHub app middleware pipeline use InvalidCookieDropper use RackContentTypeCleaner use RailsRackStatic unless %w[staging production]include?Railsenv # Enable Rack middleware for capturing (or generating) request id's use RackRequestId However,…
  • Embedding Structs in Go

    rick
    28 Aug 2013 | 5:00 pm
    I've been toying with Go off and on for the last few months. I'm finally at a point where I'm using it in a real project at GitHub, so I've been exploring it in more detail. Yesterday I saw some duplicated code that could benefit from class inheritance. This isn't Ruby, so I eventually figured out that Go calls this "embedding." This is something I missed from my first run through the Effective Go book. Let's start with a basic struct that serves as the super class. type SuperStruct struct PublicField string privateField string func s SuperStruct Foo fmtPrintlnsPublicField sprivateField It's…
  • add this feed to my.Alltop

    Obie Fernandez

  • Do. Or Do Not. There is No Try.

    Obie Fernandez
    14 Sep 2014 | 11:16 am
    A reminder that I come back to time and again.
  • Demo of QuickMVP

    Obie Fernandez
    12 Sep 2014 | 7:45 am
    The video features my partners at Javelin, Grace and Trevor, presenting QuickMVP to the NY Tech Meetup, one of the most prestigious in the world. I don't think our idea particular complicated or anything, but I'm proud of our execution on this one. QuickMVP is a landing page builder + easy creation of Google Ads to drive early adopter traffic + tool suite to be able to analyze results of your experiments in a way that's compatible with lean startup best practices. This video is actually one of the best demos of the software out there. Learn why this product is driving more and more recurring…
  • The Future of Consulting

    Obie Fernandez
    5 Aug 2014 | 11:12 am
    I am doing an online (live) panel discussion with special guests a little less than an hour from now. https://www.airpair.com/airconf2014/keynote/future-of-consulting Here is a brief list of topics that we hope to cover: - state of software consulting today. static? growing? - what are the external forces shaping change in the industry? - opportunities of ongoing engagement outside traditional project-based models - should firms be looking to unbundle services? - or additional bundling and/or co-promotion of educational and othe rservices (ala Thoughtbot) - what is the proper balance of…
  • How to Write and Publish a Technical Book (and make lots of money)

    Obie Fernandez
    28 Apr 2014 | 5:56 pm
    Over the course of the last few years, the tech publishing market has changed. Authors are in a much better position than ever before. If you are serious about success as a technical author, here are your up-to-date instructions. As long as your content is solid and valuable to your audience, I believe this is how you make the most money. You'll also reap serious long-term benefits. First of all, are you talking to a publisher about a book deal already? Maybe you have a book proposal and/or outline in hand already? Good. That's a good starting place, but it's time to get in the driver's seat.
  • 8 Apr 2014 | 3:41 pm

    Obie Fernandez
    8 Apr 2014 | 3:41 pm
    Glad to announce that my latest book, The Lean Enterprise, is now widely available in print and Kindle editions on Amazon. Getting lots of great reviews already!
 
  • add this feed to my.Alltop

    Jay Fields' Thoughts

  • The Case for Buying Technical Books

    Jay Fields
    25 Aug 2014 | 1:50 pm
    In the past few months I've seen more than a few articles encouraging programmers to write books. Each article provides at least a bit of good advice, and proceeds to conclude with the same idea:You should write a book to build your brand.I find this conclusion accurate and extremely disappointing. If the overwhelming reason to write a book is brand building, then the pool of potential authors is restricted to people who would benefit from brand building (and people who don't value their time).How Did We Get Here?The Internet, obviously. Practically everyone knows how to download any movie,…
  • Solitary Unit Test

    Jay Fields
    16 Jul 2014 | 12:55 pm
    Originally found in Working Effectively with Unit TestsIt’s common to unit test at the class level. The Foo class will have an associated FooTestsclass. Solitary Unit Tests follow two additional constraints: Never cross boundaries The Class Under Test should be the only concrete class found in a test. Never cross boundaries is a fairly simple, yet controversial piece of advice. In 2004, Bill Caputo wrote about this advice, and defined a boundary as: ”...a database, a queue, another system...”. The advice is simple: accessing a database, network, or file system significantly increases…
  • Working Effectively with Unit Tests Rough Draft Complete

    Jay Fields
    30 Jun 2014 | 5:48 pm
    I finally put the finishing touches on the rough draft of Working Effectively with Unit Tests. It's been an interesting journey thus far, and I'm hoping the attention to detail I've put into the rough draft will translate into an enjoyable read. What I did poorly: I'd written the book's sample before I ever put it on leanpub. Before a book is published you can collect contact and price information from those who are interested. However, once you publish and begin selling, you no longer have the ability to collect the previously mentioned information. I published and began selling my book…
  • Working Effectively with Unit Tests

    Jay Fields
    21 May 2014 | 4:29 am
    Unit Testing has moved from fringe to mainstream, which is a great thing. Unfortunately, as a side effect developers are creating mountains of unmaintainable tests. I've been fighting the maintenance battle pretty aggressively for years, and I've decided to write a book that captures what I believe is the most effective way to test. From the PrefaceOver a dozen years ago I read Refactoring for the first time; it immediately became my bible. While Refactoring isn’t about testing, it explicitly states: If you want to refactor, the essential precondition is having solid tests. At that time, if…
  • Weighing in on Long Live Testing

    Jay Fields
    19 May 2014 | 9:52 am
    DHH recently wrote a provocative piece that gave some views into how he does and doesn't test these days. While I don't think I agree with him completely, I applaud his willingness to speak out against TDD dogma. I've written publicly about not buying the pair-programming dogma, but I hadn't previously been brave enough to admit that I no longer TDD the vast majority of the time. The truth is, I haven't been dogmatic about TDD in quite some time. Over 6 years ago I was on a ThoughtWorks project where I couldn't think of a single good reason to TDD the code I was working on. To be honest,…
  • add this feed to my.Alltop

    パズドラの裏ワザで最強プレイヤーへの道

  • どんどん強くなってる♪

    admin
    31 Aug 2014 | 1:47 am
    前に紹介したパズドラの裏技使って着々と強くなってきてる私だけど、裏ワザ以外に最近気づいちゃったことがあるから書いてくねー! 一緒にダンジョンをクリアしてってくれる助っ人のフレンドも強い人を選ぶのはもちろんなんだけど、なるべく自分のパーティーに足りない強さの属性を選んでダンジョンに挑戦すればもっとサクサク進んでいくよ。 後はパーティーを組むときに闇属性だけとか面白いよ。…
  • パズドラの裏ワザで

    admin
    25 Aug 2014 | 1:09 am
    パズドラが強くて有名な人って男性が多いイメージ。 女性の私だってパズドラ強くなって有名になりたい!www ・・・ということで裏ワザを使って強くなろうと思いまして。 だって普通にプレイしていたら有名になるくらい強くなるなんて無理だし。 なぜならするには何十万円と課金しなくてはいけないし、寝る時間を削ってまでパズドラをしなくちゃいけない・・・…
 
  • add this feed to my.Alltop

    Polishing Ruby + Software Releases - zenspider.com

  • One Reservoir Nerd Left

    ryan davis
    12 Sep 2014 | 12:00 pm
    And then there was one. (2,060 days later, a bit slower than the movie). Unlike last time, this time it’s just me. 23 years experience, 14 (next month) in ruby, I’m available and looking. I would love to wind up doing more open source work, or helping to optimize your people/processes/codes. I’ll be speaking at gogaruco next week. If you’re nearby, you should come talk to me.
  • minitest-bisect version 1.1.0 has been released!

    ryan davis
    8 Sep 2014 | 5:07 pm
    Hunting down random test failures can be very very difficult, sometimes impossible, but minitest-bisect makes it easy. minitest-bisect helps you isolate and debug random test failures. If your tests only fail randomly, you can reproduce the error consistently by using --seed <num>, but what then? How do you figure out which combination of tests out of hundreds are responsible for the failure? You know which test is failing, but what others are causing it to fail or were helping it succeed in a different order? That’s what minitest-bisect does best. Changes: 1.1.0 / 2014-09-08 4…
  • oedipus_lex version 2.4.0 has been released!

    ryan davis
    29 Aug 2014 | 5:50 pm
    Oedipus Lex is a lexer generator in the same family as Rexical and Rex. Oedipus Lex is my independent lexer fork of Rexical. Rexical was in turn a fork of Rex. We’ve been unable to contact the author of rex in order to take it over, fix it up, extend it, and relicense it to MIT. So, Oedipus was written clean-room in order to bypass licensing constraints (and because bootstrapping is fun). Oedipus brings a lot of extras to the table and at this point is only historically related to rexical. The syntax has changed enough that any rexical lexer will have to be tweaked to work inside of…
  • minitest-bisect version 1.0.0 has been released!

    ryan davis
    29 Aug 2014 | 5:40 pm
    Hunting down random test failures can be very very difficult, sometimes impossible, but minitest-bisect makes it easy. minitest-bisect helps you isolate and debug random test failures. If your tests only fail randomly, you can reproduce the error consistently by using --seed <num>, but what then? How do you figure out which combination of tests out of hundreds are responsible for the failure? You know which test is failing, but what others are causing it to fail or were helping it succeed in a different order? That’s what minitest-bisect does best. Changes: 1.0.0 / 2014-07-16 1…
  • minitest-gcstats version 1.0.0 has been released!

    ryan davis
    29 Aug 2014 | 5:36 pm
    A minitest plugin that adds a report of the top tests by number of objects allocated. Changes: 1.0.0 / 2014-08-29 1 major enhancement Birthday! home: https://github.com/seattlerb/minitest-gcstats rdoc: http://docs.seattlerb.org/minitest-gcstats
  • add this feed to my.Alltop

    Josh Huckabee

  • Getting Started with Polymer in Ruby on Rails

    jhuckabee
    9 Sep 2014 | 8:16 am
    Polymer is a polyfill framework for the upcoming Web Components standards. Web Components is a set of new standards that encompass Shadow DOM, Custom Elements, and HTML Imports. Together, these standards make it easy to extend the nature of the web by creating a reusable set of widgets similar to the ones already provided by standard HTML elements. At the time of this writing, there are 3 ongoing efforts to integrate Polymer with Ruby on Rails. They are: nevir/polymer-rails alchapone/polymer-rails ahuth/emcee All three of these projects have a similar approach. They integrate with Sprockets…
  • Hire Me!

    jhuckabee
    5 Sep 2014 | 4:15 pm
    I am a full-stack software developer with expertise in Ruby, Ruby on Rails, Javacript, Coffeescript, and friends. I am currently looking for a short-term remote opportunity. If you or your team need a hand with your RoR project, I'm your guy. Get in touch.
  • Setting up a Canvas LMS Development Virtual Machine

    jhuckabee
    13 Jan 2013 | 6:03 pm
    Canvas is an open source Learning Management System (LMS) developed by Instructure. Canvas caught my attention when it was released two years ago primarily because it was developed using Ruby and Ruby on Rails. As of this posting, it's still using Rails 2.3.x and Ruby 1.8. When it just so happened that I would actually need an LMS as part of another project that I was working on last December, I jumped at the opportunity to try Canvas. Part of acquainting myself with that codebase involved setting up the project and all of its system dependencies based on Canvas's own Quick Start Guide. To…
  • Integrating Devise with Backbone.js

    jhuckabee
    30 Apr 2012 | 12:30 pm
    For the impatient: view the code, or see the demo. Update 30 May 2012: The original version of the application and this article referenced the backbone.modelbinding project by Derick Bailey. Per the readme, that project has been abandoned and I have replaced backbone.modelbinding with the preferred backbone.modelbinder project. All code and referenced samples below have been updated accordingly. read more
  • jQuery with Rails 3

    jhuckabee
    8 Feb 2010 | 2:04 pm
    Update: Since this article was written, the jquery-ujs project has been turned into a gem which includes a generator that streamlines this process. Instructions can be found in the README for the Github project. One of the most talked about features in Rails 3 is its plug & play architecture with various frameworks like Datamapper in place of ActiveRecord for the ORM or jQuery for javascript. However, I've yet to see much info on how to actually do this with the javascript framework. Fortunately, it looks like a lot of the hard work has already been done. Rails now emits HTML that is…
  • add this feed to my.Alltop

    Vinsol - Ruby on Rails, iOS, Android Consulting and Development

  • Advocating Fragment Oriented Applications in Android

    achin
    15 Sep 2014 | 7:47 am
    This is a series of 6 blog posts which explains about Fragment Oriented Architecture in Android applications. In this first post, I’m going to explain what is Fragment Oriented Architecture and why shall one care. In subsequent posts I’m going to talk about following topics. Transaction BackStack and its management Inter-Fragment Communication Back button press handling in fragments Session management example – Facebook Integration Fragment view state retention (projected as more of a downside). Check out this video. It takes you on a tour through what all we’re…
  • User Phone Verification – A way to prevent fraud in e-commerce

    Manish Kangia
    12 Sep 2014 | 7:43 am
    Recently in one of our e-commerce projects we implemented phone verification for users to have authentic accounts at our website. The requirement was to have one account per user to avoid misuse of offers provided by our service on scenarios like signup, high-value purchase, referring a new user to shop at our site plus other special offers. So we decided to verify users using phone number verification that seemed more reliable than email verification since having multiple phone numbers is not as easy and rare as compared to having multiple email accounts. We then chalked out a simple…
  • Compiling native libraries for Android L

    Hitesh Sondhi
    19 Aug 2014 | 7:32 am
    Preparing your app for Android L ? While using native executables in our existing Android apps we observed that those executables were no more working with Android L. We came to know that Android has introduced one more security feature starting from Android L i.e Executable must be PIE (Position independent executable). To compile a library adhering to above security feature you just need to follow these steps: Set following LDFLAGS or linker flags : -pie -fPIE Add --with-pic option while configuring the library. Some libraries might use different configure options to compile the code with…
  • Bubble Validations

    Divya
    14 Aug 2014 | 8:02 am
    We were developing a Content Management System which is composed of different components, with each component having dependency on other components in the hierarchy. Our CMS has the following structure : Site has_many pages Page has_many sections Section has_many embedded_modules EmbeddedModule has_many elements Problem Statement For any component to be publishable, we need to ensure that not only a particular component, but also its descendants(children) should satisfy the criteria of publishability. In our case a Page could be publishable, if all sections belonging to it were publishable. A…
  • Spree Loyalty Points Extension

    Mayank Tandon
    12 Aug 2014 | 6:20 am
    Most online stores thrive on customer satisfaction and their loyalty towards their stores. In order to improve the long term relationship with the customers and earn their loyalty, stores come up with different ideas to keep customers engaged. One such idea is to award loyalty points to the customer based on their purchases. These awarded points can be used by customers as a discount in their future purchases. Understanding the need, we recently published this new extension “Spree Loyalty Points” which adds the loyalty points functionality into the existing e-commerce system. With…
 
  • add this feed to my.Alltop

    Ruby-coloured glasses

  • Gotchas: rspec expect change gives: "nil is not a symbol"

    Taryn East
    12 Sep 2014 | 12:53 am
    *sigh* There's a small, but meaningful difference between: expect { my_thing.do_stuff }.to change(my_thing.my_value).to(some_value) and expect { my_thing.do_stuff }.to change{my_thing.my_value}.to(some_value) (note the braces on the last line...)
  • gotchas: require/permitting an array of ids

    Taryn East
    5 Sep 2014 | 6:53 pm
    This one got me the other day... it seems that sometimes the following won't work: params.require(:my_thing).permit(:widget_ids) When the set of ids is expected to be an array, instead use params.require(:my_thing).permit(:widget_ids => [])
  • String#gollumize

    Taryn East
    31 Aug 2014 | 12:11 am
    class String def gollumize self.pluralize + "es" end end "pocket".gollumize => "pocketses" ...just because :D
  • Life at 38

    Taryn East
    24 Aug 2014 | 5:11 pm
    When I was 5 I liked to do jigsaw puzzles upside down (to make it harder) and blow bubbles off the balcony -- watching them drift over the street. I liked to walk to school by myself (one block) and learn Origami from the lady in the flats behind us. When I was 7 I wished on every star that I could have a baby sister. When I was 8, I got one. When I was 10 I liked to explore the backways of Oyster Bay, picking flowers to make perfume (which smelled terrible). I played fantasy make-believe games with my cousins - involving magic and unicorns, where we saved the world. When I was 12 I got…
  • STOP YELLING! or how to validate a field isn't in ALLCAPS

    Taryn East
    18 Aug 2014 | 6:11 pm
    TuShare lets people give away things they no longer need. It turns out that some people think that putting their headings in ALLCAPS will get more attention... but we think it just annoys people (nobody likes to BE YELLED AT!). Here's a quick snippet that lets you validate that your users aren't YELLING AT YOU! in any given field. 1) create a custom validator in app/validators/not_allcaps_validator.rb with the following code: # we don't want our users YELLING AT US! class NotAllcapsValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value.present? &&…
Log in