Quantcast
Channel: dan.thoughts » Programming
Browsing latest articles
Browse All 10 View Live

Rails-like PHP url router

My previous version of php url router was not good enough, so i`ve done some core modification to the class. Its more flexible now. The whole idea is very similar to Rails` and Merb`s url router (merb...

View Article



How to identify your clients` browser type

Some time ago i wrote a simple regex patterns to determine whether my client crawler bot, mobile client or just regular one. Easy to expand and to use. function is_mobile($agent) { $pattern =...

View Article

How to test mailers in Sinatra, Rails and Merb

Once you need to test mailers within your Sinara, Rails or Merb application you wish to see a real output. No need to setup delivery via SMTP. Just create an executable ruby script somewhere, for...

View Article

Image may be NSFW.
Clik here to view.

Making colorized console output with Ruby

If you develop some console application you might want your output be more informative, have different colors for operations or logging purposes. It is possible to do with general ANSI escape codes,...

View Article

Making HTTP requests from different network interfaces with Ruby and Curb

At some point you will find that you have reached requests per IP limit while using some API or crawling resources. And if you`re doing it via standard Net::HTTP you`ll face the problem that you cannot...

View Article


Handy HTTP requests with Curb and Ruby

While working on one of the projects, i tried to find multi-purpose HTTP request class that can use different network interfaces/ip addresses with retry option (if connection slow or server not...

View Article

Using Amazon product images on your website

Amazon has an awesome image service. You can use their product images on your site, adjusting them for you needs. All you have to know – one image url of your product. Having that string will provide...

View Article

Image may be NSFW.
Clik here to view.

Debugging PHP applications in terminal

Most of Ruby web frameworks have terminal logging in development environments. It makes application debugging process much easier than using file logging. Especially for AJAX requests. Of course there...

View Article


Disable auto-incremental field in Rails Migrations

Since i`ve been using both DataMapper (Merb/Sinatra) and ActiveRecord (Rails) a lot i noticed that AR acts weight when i manually set PK key, particularly ID field, which you dont have to define by...

View Article


Custom field aggregations in Sphinx using SphinxQL

Sphinx is a really powerful tool for a full-text database search. It is the perfect option as a search engine on your website’s data. In default mode it works as a regular tcp server and has multiple...

View Article
Browsing latest articles
Browse All 10 View Live




Latest Images