Ruby

  • Most Topular Stories

  • Exposing a Javascript API in a Web Page with Browserify

    Ryan Daigle
    Ryan Daigle
    8 Oct 2014 | 5:00 pm
    When using Browserify to build and resolve your javascript library dependencies, it’s very easy to get a resulting bundle.js file that you can include in a browser with a simple script tag. <script src="/assets/bundle.js"></script> Including the bundle in this way will execute the code in your entrypoint (often main.js) which is where most online tutorials end and which might be all you need. However, how do you create a bundle that will expose an API to the including page? So you can do something like: <script…
  • Scaling Ruby on Rails by Caching your database queries

    Codebeerstartups
    Mohit Jain
    22 Nov 2014 | 11:02 am
    Its pretty good to use active-record in ruby on rails, relationships, find_by methods, where queries everything makes your life much more simpler as a developer but sooner or later your application becomes slow. At that time you need to work on optimizations. There are lot of work around for optimizations and one of them in caching the queries. The company I work for is StudyPad and we have a product ie splashmath and that has over 9 millions users using it across multiple platforms. The amount of traffic that we get is pretty huge and caching one of the thing that helped us to solve out…
  • String Interpolation: The Bad Parts

    RubyFlow
    25 Nov 2014 | 8:58 am
    String interpolation in Ruby is great. It’s one of those niceties that I really miss whenever I venture into JavaScript land. But watch out! There are some lesser known “features” of Ruby’s string interpolation that can burn you… badly. Learn how.
  • Generate an Apple Pay CSR with OpenSSL

    Ryan Daigle
    Ryan Daigle
    5 Nov 2014 | 4:00 pm
    When creating an Apple Pay certificate signing request, Apple specifies that you need to use a 256 bit elliptic curve key pair. To generate both the private key and the CSR using the openssl command line utility, do the following: $ openssl ecparam -out private.key -name prime256v1 -genkey $ openssl req -new -sha256 -key private.key -nodes -out request.csr -subj '/O=Your Name or Company/C=US' The result will be a private key file at private.key and the CSR in request.csr. They should look something like this. private.key -----BEGIN EC…
  • The Wasp, the Caterpillar, and Cannibalizing Your Own Product from the Inside

    slash7 with Amy Hoy
    Amy Hoy
    10 Nov 2014 | 9:31 am
    This December, Freckle Time Tracking turns 6 years old. OMG! And 30×500 turns 5 years old… after a fashion. You see, the original 30×500 is dead. And the one before that. And the one before that. And the one before that, too. We killed them. Slowly. And we’re still killing them, even as I write this. The 30×500 that just wrapped up for 30 students is just about expired. This winter, we’re launching the culmination of 5 years of teaching designers & developers to make their very first product dollar. We’re making the very first go-at-your-own-pace…
  • add this feed to my.Alltop

    RubyFlow

  • String Interpolation: The Bad Parts

    25 Nov 2014 | 8:58 am
    String interpolation in Ruby is great. It’s one of those niceties that I really miss whenever I venture into JavaScript land. But watch out! There are some lesser known “features” of Ruby’s string interpolation that can burn you… badly. Learn how.
  • How I sped up our Rails Test Suite by 267%

    25 Nov 2014 | 8:46 am
    This article writes about speeding up a rails rest suite significantly by avoiding common pitfalls. This part of the series talks about cucumber improvements and using poltergeist. How I sped up our Rails Test Suite by 267%
  • Each... or else

    25 Nov 2014 | 8:10 am
    I love each, but I have a problem with it. How do you handle an empty collection?
  • Introducing Phusion Passenger 5 beta 1 (codename "Raptor")

    25 Nov 2014 | 7:19 am
    Version 5.0.0 beta 1 of the popular Phusion Passenger app server has been released. This release is codenamed "Raptor", is much faster, helps you better identify and solve problems, and has a ton of other improvements.
  • Log tagging in Rails

    25 Nov 2014 | 4:21 am
    Whilst deploying a large application to Heroku, we needed a way to trace application requests from the second they come into the router through to when the request completes. Enter log tagging.
 
  • add this feed to my.Alltop

    Ryan Daigle

  • Generate an Apple Pay CSR with OpenSSL

    Ryan Daigle
    5 Nov 2014 | 4:00 pm
    When creating an Apple Pay certificate signing request, Apple specifies that you need to use a 256 bit elliptic curve key pair. To generate both the private key and the CSR using the openssl command line utility, do the following: $ openssl ecparam -out private.key -name prime256v1 -genkey $ openssl req -new -sha256 -key private.key -nodes -out request.csr -subj '/O=Your Name or Company/C=US' The result will be a private key file at private.key and the CSR in request.csr. They should look something like this. private.key -----BEGIN EC…
  • Exposing a Javascript API in a Web Page with Browserify

    Ryan Daigle
    8 Oct 2014 | 5:00 pm
    When using Browserify to build and resolve your javascript library dependencies, it’s very easy to get a resulting bundle.js file that you can include in a browser with a simple script tag. <script src="/assets/bundle.js"></script> Including the bundle in this way will execute the code in your entrypoint (often main.js) which is where most online tutorials end and which might be all you need. However, how do you create a bundle that will expose an API to the including page? So you can do something like: <script…
  • Time-Series Database Design with InfluxDB

    Ryan Daigle
    12 Aug 2014 | 5:00 pm
    Here at Spreedly we’ve recently started using the time series database InfluxDB to store a variety of customer activity metrics. As with any special purpose database, using and designing for a time-series database is quite different than what you may be used to with structured (SQL) databases. I’d like to describe our experience designing our InfluxDB schema, the mistakes we made, and the conclusions we’ve come to based on those experiences. The mark Consider the following scenario, closely resembling Spreedly’s: You run a service that lets your customers transact…
  • The New Gist: What It Is and What It Could Be

    Ryan Daigle
    12 Dec 2012 | 4:00 pm
    Gist is an incredible tool by Github for quickly sharing code, text and files. It has syntax highlighting and rendering for a huge number of programming languages including Markdown for text. For many techies, including myself, Gist is an indispensable tool for quickly sharing code and content with coworkers. Gist has been around for several years now and, when compared with the pace of development on the main Github.com property, has been relatively neglected. Thankfully, Github recently updated Gist with a fresh new codebase and UI. As a heavy user of Gist I have some thoughts on this…
  • Site Relaunch

    Ryan Daigle
    7 Feb 2012 | 4:00 pm
    I’m currently in the middle of putting a fresh coat of paint on RyanDaigle.com, the previous home of the What’s new in Edge Rails series. All old links to http://ryandaigle.com/articles will be redirected to an archived version of the site at http://archives.ryandaigle.com. I doubt all links will make the change, but I’ve given it my best effort. Don’t have any big plans for the site beyond a renewed effort at writing more. Stay tuned.
  • add this feed to my.Alltop

    slash7 with Amy Hoy

  • The Wasp, the Caterpillar, and Cannibalizing Your Own Product from the Inside

    Amy Hoy
    10 Nov 2014 | 9:31 am
    This December, Freckle Time Tracking turns 6 years old. OMG! And 30×500 turns 5 years old… after a fashion. You see, the original 30×500 is dead. And the one before that. And the one before that. And the one before that, too. We killed them. Slowly. And we’re still killing them, even as I write this. The 30×500 that just wrapped up for 30 students is just about expired. This winter, we’re launching the culmination of 5 years of teaching designers & developers to make their very first product dollar. We’re making the very first go-at-your-own-pace…
  • The Wasp, the Caterpillar, and Cannibalizing Your Own Product from the Inside

    Amy Hoy
    10 Nov 2014 | 9:31 am
    This December, Freckle Time Tracking turns 6 years old. OMG! And 30×500 turns 5 years old… after a fashion. You see, the original 30×500 is dead. And the one before that. And the one before that. And the one before that, too. We killed them. Slowly. And we’re still killing them, even as I write this. The 30×500 that just wrapped up for 30 students is just about expired. This winter, we’re launching the culmination of 5 years of teaching designers & developers to make their very first product dollar. We’re making the very first go-at-your-own-pace…
  • What if your product launch fails? This interview will give you $10k reasons to do it anyway.

    Amy Hoy
    3 Nov 2014 | 6:57 pm
    If there’s one thing Amy and I hear from our students, both directly and indirectly, it’s “I’m worried I’m going to fuck this up.” After teaching hundreds of students the 30×500 processes and techniques, there’s only one difference that stands out between the people who succeed and everyone else: Action vs. inaction. Doing the work vs. making excuses. Trying vs. resisting. Call it what you want, the source of inaction is the same nearly 90% of the time. People are terrified of doing things wrong. And then there are the people who take what…
  • How to design the most efficient software your users have ever seen

    Amy Hoy
    17 Oct 2014 | 8:49 am
    When’s the last time you heard or read somebody discussing efficiency in software experience? Probably just about never, I’d wager. It’s not trendy. It’s not sexy. It’s certainly not easy… you can’t apply it with a Node.js library or an icon font. This is not the sound of a grumpy old lady waving her cane at the kids — it’s the sound of opportunity begging you to take it. If you design[1] software[2], this post will make you money. [1] if you make decisions about your company’s software products in any way, even if you don’t think of…
  • My secret startup past

    Amy Hoy
    13 Oct 2014 | 2:40 pm
    I’ve been designing & developing for hire since I was 14. But I almost never write about my past. It’s old hat to me. I’m an always-moving-forward kind of girl. This has led many to assume my strongly opinions on bootstrapping come ex nihilo — or possibly from bitchy sour grapes at being excluded from Startuplandia, unable to reach that sweet venture dolla dolla. Quite the opposite. I wrote, once before, three second-hand tales from the startup trenches that I had the privilege (or misfortune) of witnessing. Here are my stories. Let’s start with what may seem…
 
  • add this feed to my.Alltop

    Polishing Ruby + Software Releases - zenspider.com

  • rdoc_osx_dictionary version 2.1.0 has been released!

    ryan davis
    11 Nov 2014 | 4:09 pm
    rdoc via Apple’s Dictionary.app. Automatically builds and installs an Apple Dictionary with all rdoc nicely formatted. Inspired by: http://priithaamer.com/blog/ruby-on-rails-dictionary-for-macosx Changes: 2.1.0 / 2014-11-11 1 major enhancement: Enable to work with rdoc 4 and newer dictionary dev kits. (zalt50) 1 bug fix: Removed dead rubyforge setting in Rakefile home: https://github.com/seattlerb/rdoc_osx_dictionary rdoc: http://docs.seattlerb.org/rdoc_osx_dictionary
  • omnifocus-github version 1.8.0 has been released!

    ryan davis
    11 Nov 2014 | 3:56 pm
    Plugin for omnifocus gem to provide github BTS synchronization. Support for Github Enterprise: In your git config, set the key omnifocus-github.accounts to a space separated list of github accounts. git config --global omnifocus-github.accounts "github myghe" For each account API and web end points and authentication information should be stored in the git config under a key matching the account. For example: git config --global github.user me git config --global github.password mypassword git config --global myghe.api https://ghe.mydomain.com/api/v3 git config --global myghe.api…
  • minitest version 5.4.3 has been released!

    ryan davis
    11 Nov 2014 | 3:44 pm
    minitest provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking. "I had a class with Jim Weirich on testing last week and we were allowed to choose our testing frameworks. Kirk Haines and I were paired up and we cracked open the code for a few test frameworks... I MUST say that minitest is *very* readable / understandable compared to the 'other two' options we looked at. Nicely done and thank you for helping us keep our mental sanity." -- Wayne E. Seguin minitest/unit is a small and incredibly fast unit testing framework. It provides a rich set of…
  • imap_processor version 1.6 has been released!

    ryan davis
    17 Oct 2014 | 3:48 pm
    IMAPProcessor is a client for processing messages on an IMAP server. It provides some basic mechanisms for connecting to an IMAP server, determining capabilities and handling messages. IMAPProcessor ships with several executables which can query and manipulate IMAP mailboxes in several different ways: imap_archive :: Archives old messages to a new dated mailbox. imap_cleanse :: Delete messages older than a certain age in specified mailboxes. imap_flag :: Flag messages to/from certain people. imap_idle :: Shows new messages in a mailbox. imap_keywords :: Queries an IMAP server for keywords set…
  • Happy Birfday to me!

    ryan davis
    15 Oct 2014 | 6:13 pm
    Today is my Fourteenth Year Anniversary with Ruby! Yay! 823 gem releases (up by 93), 9805 commits (up by 823), and bazillions of test runs later, and I’m still going strong. Rawr!
  • add this feed to my.Alltop

    Saturn Flyer with Jim Gay

  • Clean Ruby 1.0 is released!

    22 Nov 2014 | 9:52 am
    I’m excited to be able to call Clean Ruby “final”. The compliments to that work have been great. Here’s just a few comments I’ve received for Clean Ruby: “The current version of Clean Ruby is a great start on a critical topic. Learning how to keep code clear and understandable is useful for any kind of project. I’ve already applied a couple of ideas from the book to keep a project from mumbling in the shadows.” —David Richards “I have not come across such a revelatory approach to things since first learning OOP.” —Mike Pence…
  • Avoiding errors when forwarding to missing objects

    20 Nov 2014 | 4:00 pm
    The “final” update for Clean Ruby will be released soon. More on that below, but first here are some thoughts on what to do when you’ve got a missing object. The Ruby standard library Forwardable is really useful for raising up valuable information and hiding unimportant details. A single line of code can configure the relationship between two objects and the data they share. delegate [:street, :city, :state] => :address I’m often asked: what happens if that address is nil? In this case, you’ll see an error about an undefined method on nil: NoMethodError:…
  • Shorter, simpler code with Forwardable

    14 Nov 2014 | 4:00 pm
    I often find that visual distractions slow me down. Reading simple code with familiar concepts feels cumbersome when I have to sort through repetition to find the meaning. Take a glance at this code to see what I mean: class Person def street address.street end def city address.city end def state address.state end end Although the code is short, you have to think a bit before you realize that all of these methods do basically the same thing. Ruby has a built-in way to bring the information out of this code: Forwardable. I touched on using Forwardable in a previous article but we’ll look…
  • The tools that are right under your nose

    19 Nov 2013 | 4:00 pm
    I recently had a fantastic experience giving a presentation at RubyConf called The Secrets of the Standard Library. The slides are available and once the video is up I’ll send along a link to that. There are no secrets in the Standard Library There are no secrets, of course, because the code is right there for you to read but many developers don’t realize that powerful tools like SimpleDelegator and Forwardable are built into Ruby. There’s no gem to find and install, just require the file you need and you’ve got it. It’s as easy as: require 'delegate' class…
  • Delegation is Everything and Inheritance Does Not Exist

    17 Nov 2013 | 4:00 pm
    Sharing behavior among and between objects requires a balanced decision. Will other objects use this behavior? Which ones? Why? Should I make a new class to handle what I need? Determining answers led me to dive into exactly what delegation is and inevitably led to more research to get a better understanding of inheritance. Prefer delegation over inheritance goes the standard advice. It seems that many developers think about inheritance in terms of classes. Classes define everything about your objects so it must be the only way to handle inheritance. We tend to think about delegation in terms…
 
  • add this feed to my.Alltop

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

  • Tips for Designers: from a Developer

    alok
    20 Nov 2014 | 2:44 am
    Android is a versatile OS with more than 1000 device manufacturers and more than 18000 distinct devices. Screen size of android phones vary from 2.6” – 6” and the resolution of screen ranges from 240 X 320 to 1440 X 2560 px with screen density from 120 to 640 dpi (ldpi to xxxhdpi). It is difficult for designers to create such designs which work well on all these devices irrespective of the size, density and aspect ratio of device and still stay developer friendly. In this blogpost I will discuss some useful techniques that ease out the painful design implementation in Android…
  • Communication patterns for application components

    achin
    4 Nov 2014 | 5:34 am
    Activities, services, fragments, helper classes etc. are main components of Android applications but its tricky to establish communication between these components. It’s tricky when one cares about writing reusable code – loosely coupled, plug-n-play-able. The goal here is to avoid tight coupling. Tight coupling – Components keep references of each other and call methods on them directly. In the code below, we are keeping a reference of MagazineActivity inside MenuFragment. So, MenuFragment is tightly coupled with MagazineActivity i.e., it cannot function without MagazineActivity.
  • Fragment view state retention: A dirty solution

    achin
    22 Oct 2014 | 3:40 am
    This is the last part of this 6 part series about Fragment Oriented Architecture in Android applications. In the previous post I talked about managing sessions in fragment oriented application. In this post I am going to talk about retaining view hierarchy of a Fragment after removing it from container and then coming back to it by popping the backstack. (Sample application’s source code and README) When a fragment gets replaced by another fragment and the transaction is added to back stack, the expectation after a popBackStack() is to return to the previous fragment with its UI state…
  • Session Management

    achin
    22 Oct 2014 | 3:29 am
    This is the fifth part of a 6 posts series on Fragment oriented application architecture. In the previous post I talked about efficiently handling back button press inside fragment. In this part I am going to talk about session management in Fragment oriented application, by explaining integration of Facebook SDK. (Sample application’s source code and README) In a fragment oriented application, we can conveniently manage all session related code in the activity and all its fragments would utilise it. Facebook SDK is quite in sync with this approach. Implementation of Facebook session…
  • Handling back button press Inside Fragments

    achin
    1 Oct 2014 | 6:25 am
    This is the fourth part of a 6 posts series on Fragment oriented application architecture. In the previous post I talked about Inter-Fragment Communication. In this part I am going discuss about elegantly handling back button press inside fragments in a fragment oriented application. (Sample application’s source code and README) Android devices have a hardware back button which normally serves the purpose of going back through the screens/actions stack. Callback to a back button press event is received in the foreground Activity (onBackPressed() event callback) which can be overridden…
  • add this feed to my.Alltop

    Ruby-coloured glasses

  • Generate a subset of pseudo-random permutations in non mega-huge time

    Anonymous
    23 Nov 2014 | 6:38 pm
    One of the neat things about sending packages via sendle is that you don't have to print out a label or even know the address of your recipient (this is done so the recipient can keep their address private if they want). Instead, we give the sender a pair of unique code-names to put onto the package. So instead of J Random Shop-assistant at EvilCorp getting your full address, instead you write something like "From: Golden Lion To: Red Tiger". It's fun, as well as effective - like secret-agent names. but it does present us with an interesting problem - how do we generate unique codenames for…
  • Link: Fundamental Guidelines Of E-Commerce Checkout Design

    Anonymous
    19 Nov 2014 | 11:03 pm
    "Here is the harsh reality of e-commerce websites: according to recent e-commerce studies, at least 59.8% of potential customers abandon their shopping cart (MarketingSherpa puts it at 59.8%, SeeWhy at 83% and MarketLive at 62.14%). The main question is why do customers abandon their shopping cart so often?" Fundamental Guidelines Of E-Commerce Checkout Design condenses a large study into usability into 11 really useful guidelines to make your checkout experience much more likely to convert. Here's a condensed, tl;dr version: But I totally recommend reading the whole thing - it's not that…
  • Link: Advisory locks in postgres

    Anonymous
    13 Nov 2014 | 4:44 pm
    Advisory locks in postgres "PostgreSQL provides various lock modes to control concurrent access to data in tables. Advisory locks provide a convenient way to obtain a lock from PostgreSQL that is completely application enforced, and will not block writes to the table." This is not like row-locking your tables, this is to help you ensure concurrency for certain parts of your application. eg that you only enter a complex, resource-intensive part of your codebase once across all your servers. Given that ruby basically isn't very threadsafe - this provides a mechanism for concurrency-locking that…
  • gotcha: redirecting through root-url fails to preserve anchor tag

    Anonymous
    7 Nov 2014 | 4:52 pm
    Interesting (and annoying). If you redirect to your root-path and pass it an anchor tag like "show-help" (in some controller) eg with redirect_to root_path(:anchor => 'show-help') It first redirects correctly to /#show-help but it then further redirects to your actual root url... and removes the anchor tag eg /my_dashboard My expectation would be that it would preserve the anchor tag... eg the final URL would be: /my_dashboard#show-help But of course, the browser doesn't actually send anchor tags to the server at all... which means that after the first request (to '/'), Rails never gets the…
  • gotcha: running `rake db:migrate:redo` and testing

    Anonymous
    1 Nov 2014 | 4:17 pm
    So... rails *tells* me that rake db:test:prepare is deprecated, and that just running the specs will keep the db up-to-date... but it isn't always so. If you jigger with a brand new migration and run a rake db:migate:redo - the test db can't deal with that by itself. You either have to run rake db:migate:redo RAILS_ENV=test or rake db:test:prepare to propagate those changes.
  • add this feed to my.Alltop

    Codebeerstartups

  • Scaling Ruby on Rails by Caching your database queries

    Mohit Jain
    22 Nov 2014 | 11:02 am
    Its pretty good to use active-record in ruby on rails, relationships, find_by methods, where queries everything makes your life much more simpler as a developer but sooner or later your application becomes slow. At that time you need to work on optimizations. There are lot of work around for optimizations and one of them in caching the queries. The company I work for is StudyPad and we have a product ie splashmath and that has over 9 millions users using it across multiple platforms. The amount of traffic that we get is pretty huge and caching one of the thing that helped us to solve out…
  • Spliting Seed files into multiple file in Ruby on Rails

    Mohit Jain
    18 Jan 2014 | 10:25 am
    Last month I joined a new job after a break of almost 4 months. You can checkout the product and there we had a small problem that our seed file was growing very fast. So we did a small thing to maintain our seed file. Here is a small tip if you are having a massive seed file and its pretty easy to implement. We can store all our seeds inside the folder db/seeds and inside the db/seeds.rb we write the following: 1 DirFilejoinRailsroot 'db' 'seeds' '*.rb'sorteach seed load seed We can sort the files alphabetically before loading them. What if seed file ordering is…
  • Irreversible Migrations in Ruby on Rails

    Mohit Jain
    8 Dec 2013 | 10:25 am
    In Rails 2 in migrations there were only 2 methods: up and down. They are called on running migrations up and down respectively with rake tasks rake db:migrate and rake db:rollback. Rails 3 produced us great method change which allowed us to write there code which creates a table and drops the table automatically on rolling migration back. But unfortunately there was a problem – you didn’t have opportunity to say “don’t run this peace of code on down but run this only on up”. So the solution was just to use old syntax. Since Rails 4 has released there is a…
  • Social Login integration with all the popular social networks in ruby on rails

    Mohit Jain
    26 Oct 2013 | 11:08 am
    I have seen lot of people writting pretty messy code to integrate social logins in rails or get confused to integrate multiple social logins in rails. In order to help them I have written a small application having integrations with Twitter + Facebook + Linkedin + Google + Github. Here is the demo and here is the source code I am using devise in this application. Few things to note in this: There are two models in this application a user model and an authorizations model and a user has_many authorizations. User can link to multiple social account from edit profile Once social accounts are…
  • Parallel gem installing using Bundler

    Mohit Jain
    1 Sep 2013 | 3:39 pm
    No more waiting time. Bundler supports faster gem install as it adds support for parallel installation. You can pass in —jobs=SIZE (or -jSIZE) as a parameter to bundle install How can I use this now? Simple! Just install a prerelease version of Bundler, and you should be good to go: 1 gem install bundler pre So now the problem that bundler is taking too much time is long gone. Happy coding :)
 
Log in