ChrisDrit's Ruby Rambler http://rubyrambler.posterous.com ...a place for my coding links posterous.com Sun, 05 Dec 2010 15:08:05 -0800 Forked Devise Gem http://rubyrambler.posterous.com/forked-devise-gem http://rubyrambler.posterous.com/forked-devise-gem

Devise is an awesome gem. I recently used it with an iPhone application that I'm building, but I found a limitation when making remote authentication requests via xml. So what is one to do?

Fork it and fix it!

The XML mappings as well as some of the core lib's did not account for new registrations via xml. I still have yet to finish it off by writing some tests, but I will do this soon and send a pull request to the maintainers.

In the mean time, if you have the need to do remote registrations via XML to the Devise gem, check out my github fork.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Wed, 10 Nov 2010 16:47:00 -0800 I haven't forgotten about you RubyRambler! http://rubyrambler.posterous.com/i-havent-forgotten-about-you-rubyrambler-0 http://rubyrambler.posterous.com/i-havent-forgotten-about-you-rubyrambler-0

I know it's been awhile! But you'll be getting some love soon :)

1975_rambler_hornet_02

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Mon, 10 May 2010 13:47:04 -0700 Getting Started With Toto, a Tiny WordPress Killer - Dmitry Fadeyev http://rubyrambler.posterous.com/getting-started-with-toto-a-tiny-wordpress-ki http://rubyrambler.posterous.com/getting-started-with-toto-a-tiny-wordpress-ki
Toto stores all your posts as text files. The engine is written in the Ruby programming language and so you can use Ruby throughout your template files to add extra functionality. Additionally, Toto works extremely well with Heroku, a Ruby cloud host, which makes deployment especially easy—you can actually get a new blog up and running in about 10 seconds.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Sat, 01 May 2010 15:02:31 -0700 Hacker News | HN Contractors: Add Yourself http://rubyrambler.posterous.com/hacker-news-hn-contractors-add-yourself http://rubyrambler.posterous.com/hacker-news-hn-contractors-add-yourself
Over the last few months, I've seen a lot of HN members talk about being contractors, and why - designing to bootstrap their business, building an iPhone practice, moving to China to work and live, etc.

I'm often on the other side of that transaction, where I need to hire contractors for one or more projects, and I'd like nothing more than to hire from this group of experts, but I don't remember to bookmark every talented and possibly hungry person. I'm sure there are many other people on both sides.

So here's a Google Spreadsheet for adding yourself and your expertise so that folks who need to hire have a quick way to find HN folks: include your contact info [if you want], etc.

Spreadsheet is at https://spreadsheets.google.com/ccc?key=0AlD_6iEb8Ed9dGs3clVJYi0yYVBka181Z0ZK..., I promise to leave it there and hope that nobody's a jerk about it.

(If someone has already done this, by all means let me know or add to this thread - I just want the list, not the credit.)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Wed, 28 Apr 2010 08:33:33 -0700 What I wish a Ruby programmer had told me one year ago.. » Ruby, Python, Django, Rails, Linux, Todo-app » Sirupsen's Blog http://rubyrambler.posterous.com/what-i-wish-a-ruby-programmer-had-told-me-one http://rubyrambler.posterous.com/what-i-wish-a-ruby-programmer-had-told-me-one

Ruby is indeed evil. So evil. Extremely evil. But why so evil? Because it’s so beautiful. The syntax is so elegant, everything are objects. Everything makes sense. The Ruby-way of doing things is so sexy.

I quickly headed over to #ruby and asked them what I should do to practise my all-so-awesome Ruby skills, and some guy recommended me coding a todo-app. It seemed it was the new semi-advanced-but-no-so-advanced hello world. So I did, and here’s the extremely awesome output (be prepared, it’s extremely bad code and you should NEVER do something like this in Ruby):

A few days ago I was set off to create my first RubyGem. There are many resources on how to do this, but it took me a good while to gather all the information I figured I’d need for my application, so I’ve decided to gather my bit of knowledge in this article.

This article’s goal is kick start the creation of your first Gem. To make this experience more enjoyable, I’ve chosen to use a gem called Jeweler.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Fri, 23 Apr 2010 10:10:04 -0700 Patterns of method missing http://rubyrambler.posterous.com/patterns-of-method-missing http://rubyrambler.posterous.com/patterns-of-method-missing

One of the more dynamic features of Ruby is method_missing, a way of intercepting method calls that would cause a NoMethodError if method_missing isn’t there. This feature is by no means unique to Ruby. It exists in Smalltalk, Python, Groovy, some JavaScripts, and even most CLOS extensions have it. But Ruby being what it is, for some reason this feature seem to have more heavily used in Ruby than anywhere else. It’s also a feature most Ruby developers seem to know about. Is this because Ruby people are power hungy, crazy monkey patchers? Maybe, but method_missing is also potentially very useful, if used correctly. But of course, it’s exceedingly easy to misuse. In almost all cases you think you need method_missing, you actually don’t.

The purposes of this post is to take a look at a few ways people are using method_missing in the wild, what the consequences are and what you can do to mitigate them. I’m bound to have missed a few use cases here, so please feel free to add more in the comments.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Thu, 22 Apr 2010 14:32:15 -0700 Deceiving Users with the Facebook Like Button http://rubyrambler.posterous.com/deceiving-users-with-the-facebook-like-button-0 http://rubyrambler.posterous.com/deceiving-users-with-the-facebook-like-button-0

However, this simplicity has a cost: Users can be tricked into "Like"ing pages they're not at.

For example, try pressing this "Like" button below:




This is what happened to my Facebook feed when I pressed it:

Screen shot 2010-04-21 at 10.45.01 PM

I used BritneySpears.com as an example here to be work/family-safe; you're free to come up with examples of other sites you wouldn't want on your Facebook profile! :)

Important note: Removing the feed item from your newsfeed does not remove your like -- it stays in your profile. You have to click the button again to remove the "Like" relationship.

This works because the iframe lets me set up any URL I want. Due to the crossdomain browser security, the "Like Button" iframe really has no way to communicate with the website it's a part of. Facebook "Connect" system solved this using a crossdomain proxy, which requires uploading a file, etc. The new button trades off this security for convenience.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Tue, 20 Apr 2010 13:27:25 -0700 Announcing EventMachine CouchDB (em-couchdb) http://rubyrambler.posterous.com/announcing-eventmachine-couchdb-em-couchdb http://rubyrambler.posterous.com/announcing-eventmachine-couchdb-em-couchdb
I thought it will be a good idea to end the year with a bang.. So here is the announcement for an awesome client for CouchDB based on EventMachine.

People who follow me on twitter (@sai_venkat) know that I am crazy about things like EventMachine, node.js, eventlet and NoSql databases. This is one of my attempts to dive into the NoSql world.

I was looking for clients for CouchDB in Ruby and found most to be using Net/Http and blocking in nature. So I began my quest of writing an asynchronous non blocking awesome EventMachine based CouchDB client inspired by EventMachine::Redis client.

Here is a sample code to enjoy... It creates a database, saves a document inside it, reads the doc, deletes it and then deletes the database.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Mon, 19 Apr 2010 09:24:17 -0700 Getting Started - Making AJAX Applications Crawlable - Google Code http://rubyrambler.posterous.com/getting-started-making-ajax-applications-craw-0 http://rubyrambler.posterous.com/getting-started-making-ajax-applications-craw-0
This document outlines the steps that are necessary in order to make your AJAX application crawlable. Once you have fully understood each of these steps, it should not take you very long to actually make your application crawlable! However, you do need to understand each of the steps involved, so we recommend reading this guide in its entirety.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Thu, 15 Apr 2010 10:24:07 -0700 QuarkRuby: Ruby on Rails Security Guide http://rubyrambler.posterous.com/quarkruby-ruby-on-rails-security-guide http://rubyrambler.posterous.com/quarkruby-ruby-on-rails-security-guide

Stop spam on your website from DNS Blacklist

Avoid access to your website from IP addresses which are present in DNS Blacklist(DNSBL).

Plugin - DNSBL check

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Tue, 13 Apr 2010 08:28:07 -0700 Tagaholic - Lightning - Speed For Your Shell http://rubyrambler.posterous.com/tagaholic-lightning-speed-for-your-shell http://rubyrambler.posterous.com/tagaholic-lightning-speed-for-your-shell

less-ruby is a lightning function which wraps less with the ability to refer to system ruby files by their basenames. Being a lightning function, it can also autocomplete system ruby files:

# 1112 available system ruby files
  $ less-ruby [TAB]
  Display all 1112 possibilities? (y or n)

  $ less-ruby a[TAB]
  abbrev.rb                  abstract.rb                abstract_index_builder.rb
  $ less-ruby abb[TAB]
  $ less-ruby abbrev.rb
  # Pages /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/abbrev.rb ...

  # Autocompletion works regardless of the number of arguments
  $ less-ruby -I abbrev.rb y[TAB]
  yaml.rb      yamlnode.rb  ypath.rb
  $ less-ruby -I abbrev.rb yp[TAB]
  $ less-ruby -I abbrev.rb ypath.rb
  # Pages /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/abbrev.rb and
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/yaml/ypath.rb ...

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Mon, 12 Apr 2010 10:11:08 -0700 twitter's flockdb at master - GitHub http://rubyrambler.posterous.com/twitters-flockdb-at-master-github http://rubyrambler.posterous.com/twitters-flockdb-at-master-github
This is a distributed graph database. we use it to store social graphs (who follows whom, who blocks whom) and secondary indices at twitter.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Wed, 07 Apr 2010 09:45:55 -0700 The Twitter Engineering Blog: Introducing Gizzard, a framework for creating distributed datastores http://rubyrambler.posterous.com/the-twitter-engineering-blog-introducing-gizz http://rubyrambler.posterous.com/the-twitter-engineering-blog-introducing-gizz

How does it work?


Gizzard is middleware


Alt text

What is a sharding framework?


Twitter has built several custom distributed data-stores. Many of these solutions have a lot in common, prompting us to extract the commonalities so that they would be more easily maintainable and reusable. Thus, we have extracted Gizzard, a Scala framework that makes it easy to create custom fault-tolerant, distributed databases.

Gizzard is a framework in that it offers a basic template for solving a certain class of problem. This template is not perfect for everyone’s needs but is useful for a wide variety of data storage problems. At a high level, Gizzard is a middleware networking service that manages partitioning data across arbitrary backend datastores (e.g., SQL databases, Lucene, etc.). The partitioning rules are stored in a forwarding table that maps key ranges to partitions. Each partition manages its own replication through a declarative replication tree. Gizzard supports “migrations” (for example, elastically adding machines to the cluster) and gracefully handles failures. The system is made eventually consistent by requiring that all write-operations are idempotent and as operations fail (because of, e.g., a network partition) they are retried at a later time.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Fri, 02 Apr 2010 09:59:41 -0700 Riding Rails: Rails 3.0: Second beta release http://rubyrambler.posterous.com/riding-rails-rails-30-second-beta-release http://rubyrambler.posterous.com/riding-rails-rails-30-second-beta-release

It took longer than we thought, but then again, what doesn’t? This is the second beta release of Rails 3.0 and hopefully our last stop before a release candidate. There are still a handful of known regressions (see the list at the end), but we’ve made huge strides since the last release and so have auxiliary tools like Bundler.

You can find all the detailed changes in the the CHANGELOGs for each framework: Action Mailer, Action Pack, Active Record, Active Resource, Active Model, Active Support, Rails.

Please install beta 2 and try it out with new and existing applications. (gem install rails --prerelease after you make sure you’re on Ruby Gems 1.3.6 with gem update --system).

You can use Jeremy McAnally’s excellent rails_upgrade plugin to take a 2.3.x app to 3.0 (and get his update book too). There are already a good number of Rails 3 applications live in the wild.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Fri, 02 Apr 2010 09:50:00 -0700 Ruby on Rails Tutorial: Updating Showing And Deleting Users http://rubyrambler.posterous.com/ruby-on-rails-tutorial-learn-rails-by-example http://rubyrambler.posterous.com/ruby-on-rails-tutorial-learn-rails-by-example

Chapter 9 Updating, showing, and deleting users

In this chapter, we will complete the REST actions for the Users resource (Table 5.2) by adding edit, update, index, and destroy actions. We’ll start by giving users the ability to update their profiles, which will also provide a natural opportunity to enforce a security model (made possible by the authentication code in Chapter 8). Then we’ll make a listing of all users (also requiring authentication), which will motivate the introduction of sample data and pagination. Finally, we’ll add the ability to destroy users, wiping them from the database. Since we can’t allow just any user to have such dangerous powers, we’ll take care to create a privileged class of administrative users (admins) along the way.

I love simple tutorials on regular everyday processes - TODO: quickly breeze through this looking for any new and/or interesting strategies...

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Sun, 28 Mar 2010 11:45:28 -0700 Juggernaut http://rubyrambler.posterous.com/juggernaut-5 http://rubyrambler.posterous.com/juggernaut-5
The Juggernaut plugin for Ruby on Rails aims to revolutionize your Rails app by letting the server initiate a connection and push data to the client. In other words your app can have a real time connection to the server with the advantage of instant updates. Although the obvious use of this is for chat, the most exciting prospect is collaborative cms and wikis.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Sat, 27 Mar 2010 14:34:47 -0700 JS.Class - Ruby-style JavaScript http://rubyrambler.posterous.com/jsclass-ruby-style-javascript-0 http://rubyrambler.posterous.com/jsclass-ruby-style-javascript-0

JS.Class is designed to make JavaScript behave like Ruby in terms of its OOP structures. To this end, it provides the following features:

  • Classes and modules with Ruby-compatible inheritance
  • Subclassing and mixins
  • Late-binding arguments-optional super calls to parent classes and mixins
  • Singleton methods and eigenclasses
  • included, extended and inherited hooks
  • Method binding
  • Ports of various standard Ruby modules, including Enumerable, Hash, Set, Observable, Comparable, Forwardable

Its inheritance system supports late-bound super() calls to parent classes and modules, including calls from singleton methods. It has been designed to mimick Ruby as closely as possible, so if you know Ruby you should feel right at home.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Thu, 25 Mar 2010 12:53:00 -0700 10 things you should know about method_missing | thirdbIT http://rubyrambler.posterous.com/10-things-you-should-know-about-methodmissing http://rubyrambler.posterous.com/10-things-you-should-know-about-methodmissing
Basically, method_missing is one of the features of Ruby that make it remarkably easy to create your own DSL for fun and profit. DSLs are Domain Specific Languages, which, if you didn’t know — and of course, dear reader, you did, because you are oh-so-up on all the oh-so-fashionable programming paradigms, are the big thing that Martin Fowler is talking about a lot these days.

Ignore the wikipedia article, listen to _why, in a discussion of method_missing: “I don’t think the idea here is to save memory or speed. The idea behind metaprogramming is to teach Ruby your conventions and let it do some guessing, in order to save you some code.”

Don’t trust that _why and all his chunky bacon? Here’s David Black, equally reassuring:

One of the great accomplishments of Ruby is that its object and class model bring about a wonderful unity and simplicity. Even things that might seem like they should be hard or obscure are actually very transparent, once you have the hang of how the model works.Unfortunately, there’s a trend toward drawing an increasingly sharp line between regular programming and “metaprogramming” in Ruby discussions, where metaprogramming is understood to mean… well, I’m not sure what it’s understood to mean, the way it’s getting used in connection with Ruby, and that’s the problem.There’s no natural separation between programming and metaprogramming in Ruby, and no reason to make life harder by breaking them apart. The thrust of Ruby’s design is to dissolve complexities, so that even things that appear to be “wizardly” or full of “dark magic” actually make perfect sense in terms of a relative small number of underlying language principles.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Sun, 21 Mar 2010 09:04:00 -0700 Ruby Scales, AND It’s Fast – If You Do It Right! http://rubyrambler.posterous.com/ruby-scales-and-its-fast-if-you-do-it-right http://rubyrambler.posterous.com/ruby-scales-and-its-fast-if-you-do-it-right
Rails also supports partial caching in some different guises—to the file system, to memory, to memcached, etc. Partial caching can be a win architecturally, because it bypasses all of the heavy work involved in generating content; your app can just assemble pregenerated fragments into a complete page. If you haven’t done so, look into that as well. It can be very helpful.
Along those same conceptual lines, there’s also edge side includes, or ESI. ESI essentially lets one’s application return a skeleton of a page, or an incomplete page with some special markup embedded. The proxy that receives that content, and that understands ESI markup can then insert content, either from its own cache, or from a subrequest that it issues to some other URL.
This lets a proxy cache a generated, but incomplete page, yet still fill it out with smaller pieces of dynamically generated content without pushing all of that work back into the dynamic application. So it’s a bit like partial caching, but it’s handled at a shallower level in the stack. I’ve heard that Rails 3 will have a plugin to facilitate the use of ESI, and that it may come built in with a later dot release. Not all reverse caching proxies support ESI, but many of them do.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit
Fri, 19 Mar 2010 20:29:10 -0700 SkipfishDoc - skipfish - Project documentation - Project Hosting on Google Code http://rubyrambler.posterous.com/skipfishdoc-skipfish-project-documentation-pr http://rubyrambler.posterous.com/skipfishdoc-skipfish-project-documentation-pr

What is skipfish?

Skipfish is an active web application security reconnaissance tool. It prepares an interactive sitemap for the targeted site by carrying out a recursive crawl and dictionary-based probes. The resulting map is then annotated with the output from a number of active (but hopefully non-disruptive) security checks. The final report generated by the tool is meant to serve as a foundation for professional web application security assessments.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/316271/clown-it.png http://posterous.com/users/37lvjyvIbVnz Chris Drit ChrisDrit Chris Drit