Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Stephane BRUN www.sbnet.fr

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

email validation regex

/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/ 		

Test if called from XMLHttpRequest

if($_SERVER["HTTP_X_REQUESTED_WITH"] == 'XMLHttpRequest')
{
  // Called from XMLHttpRequest
}

using Rails env in a ruby script

RAILS_ENV = ARGV[0] || 'development'
require File.dirname(__FILE__) + '/../config/environment'
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS