Filter

Sign up for our newsletter

Recieve a selection of our favorite articles the first Friday of every month!

Articles

Article  |  Development

Fixing Wordpress URLs When Using Rack

27 Mar 2014

Tip to fix WordPress URLs

In my last article I detailed how to run PHP through a Rack server. This works fairly well until you try to sign into the Wordpress admin section.

The problem is that Wordpress stores site URLs in the database and it will use these for some redirections. Luckily, with a few Rake tasks you can painlessly override them.

Continue Reading

Article  |  Development

Wordpress and PHP on Rack

26 Mar 2014

We work primarily in Ruby on Rails, but every once and a while a client will need us to fix a critical bug in an existing PHP/Wordpress app that is slated to be deprecated.

We use Pow on our development machines. This is great for developing Rails applications but it does't play so well with other stacks that require port 80 to run.

There are some instructions out on the web that show you how to use Apache in conjunction with Pow so that both apps can be served simultaneously. This seemed like a little too much overhead, so I started poking around for a solution.

Did you know that PHP comes with an embedded web server? Yup, it's built in as of PHP 5.4 and OS X Mavericks comes with it pre-installed. If you're looking for a newer version, you can install 5.5 using homebrew-php.

Now that we don't need Apache to run PHP, we'll need something to proxy requests back to our embedded server. For this, I used Rack.

I setup a simple Gemfile with the following gems:

gem 'rack'
gem 'rack-legacy'

Then it's time to create our rackup file. Create a file titled config.ru and add the following:

require 'rubygems'
require 'bundler'

Bundler.setup

require 'rack'
require 'rack-legacy'

use Rack::ShowExceptions
use Rack::Legacy::Index
use Rack::Legacy::Php
run Rack::File.new Dir.getwd

That's it! Place this file into the root of your PHP project and you should be able to call rackup from the terminal to start the Rack server. By default this will be at http://0.0.0.0:9292.

There is one caveat though. At this time, Rack Legacy, will only respond to requests if it thinks that it's a valid PHP file.

From the Rack Legacy library this is called before a request is proxied:

def valid? path
    return false unless path =~ /\.php/

    path = path[1..-1] if path =~ /^\//
    path = path.split('.php', 2)[0] + '.php'
    path = ::File.expand_path path, @public_dir
    ::File.file? path
end

In our case this wasn't working for us because of the way that pretty URLs were being handled by Wordpress. In order to get around that, I monkey-patched Rack Legacy to simply pass all requests back to PHP.

Here is what I added to the config.ru file to make this happen:

class Rack::Legacy::Php
    def valid? path
        return true
    end
end

With that change, the Wordpress site was working as expected.

Continue Reading

Article  |  Development

CKEditor and Word Counts

4 Mar 2014

Tip to add word counts to CKEditor

In a project we’re currently working on, we created a form builder that could publish complex forms that include features such as:

  • Logic that can be applied to different fields, sections and pages
  • Configurable validations
  • Word counts by field, section or complete form
  • Option to allow some textareas to have WYSIWYG content

Continue Reading

Article  |  UX

It's the small things...HipChat's HEX swatches

4 Mar 2014

Several months ago, our team left Campfire and entered HipChat for all internal conversations project, team, or cute kitten related. There are a few great things about using HipChat, but one of my favorite’s as a designer is this; adding a swatch of any HEX code. This feature not only provides my teammate with the code to add for a color, but also provides more context when we are collaborating. It’s a small thing, but sometimes, the small things just make life a little better.

What are the small things you like about the tools you use?

Continue Reading

Article  |  Studio

Lessons from Planet Argon Junior Developers

27 Feb 2014

Planet Argon hired two Epicodus graduates as junior Ruby on Rails developers: Abby Smalls and Ana Tighe. I took some time to sit down with them and see how things are going so far. It was great talking to them about their experiences starting as junior developers here. We touched on some interesting points, including company culture, favorite apps, music, and some insights for people interested in development.

Abby Smalls and Ana Tighe

Continue Reading

Article  |  Work

Javelin Security Launches

24 Feb 2014

We are excited to announce the launch of Javelin Security, a computer security service that simulates real-world attacks on a company’s security infrastructure, designed to reveal the weaknesses and provide the tools to strengthen it.

Continue Reading

Article  |  Development

The Pros and Cons of Modular Sass

7 Jan 2014

Using modular Sass

In the past year or so, the front-end developers at Planet Argon have taken more of a modular approach to writing CSS. This means writing CSS in a way that promotes forward-thinking, scalability, and ease of development. Before I get into the pros and cons, here’s a quick example of the difference between a modular and non-modular approach.

Continue Reading

Article  |  Development

Epicodus - What are the Students Saying? Part 1

6 Nov 2013

Throughout this week I’ll be posting my interviews with three students from local code school, Epicodus. They’ll talk about their experiences with the program and how they have been growing as web developers in the past few months.

With the emergence of of code schools in recent years, it can be hard to keep track of them all. Which ones should we be paying attention to as potential employers or students? I wanted to delve a little deeper and take a look at how current students felt about the program.

Today we hear from Braden O’Guinn and his experience with Epicodus.

Continue Reading

Article  |  Development

OS X Mavericks, failing specs and libxml

24 Oct 2013

After an OS X upgrade from 10.8 to 10.9, I noticed some previously-passing Capybara specs were failing. The failing specs all shared a similar structure:

  it 'should show some text in the 2nd tr' do
     visit some_path
     page.should have_selector('tr:nth-child(2)', text: 'some text')
  end

Notice nth-child pseudo-selector; this seemed likely to be involved as other specs using have_selector with plain class selectors continued to pass.

I applied a number of patches that folks seem to be performing on their new 10.9 installs (installed XCode 5.0.1 and then dev tools via xcode-select --install, running brew updates, etc) and nothing changed. What led me to a solution was this Nokogiri Github issue from the Mountain Lion release:

https://github.com/sparklemotion/nokogiri/issues/742

I ran one of my failing specs with the DYLD_PRINT_LIBRARIES=1 flag mentioned in this issue:

dyld: loaded: /usr/lib/libxml2.2.dylib
dyld: loaded: [repo]/vendor/ruby/1.9.1/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0/lib/libxml2.2.dylib

As the issue suggests, I added a reference to Nokogiri directly below Rails in my Gemfile (it did not have an explicit reference in the Gemfile before this). After that, I see this load order:

dyld: loaded: [repo]/vendor/ruby/1.9.1/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0/lib/libxml2.2.dylib
dyld: loaded: /usr/lib/libxml2.2.dylib

With the libxml dylib loaded first from the bundled Nokogiri, my specs pass again.

Continue Reading

Have a project that needs help?

New Call-to-action