Railsmine: The Ruby Way to do URL Validation
february 2012 by phaedrix
URL_REGEX = /^https?://
(?<fqdn>
# Host part (the first token)
(?<host_dot>(?:[x09x0Ax0Dx21-x7E]|[xC2-xDF][x80-xBF]|xE0[xA0-xBF][x80-xBF]|[xE1-xECxEExEF][x80-xBF]{2}|xED[x80-x9F][x80-xBF]|xF0[x90-xBF][x80-xBF]{2}|[xF1-xF3][x80-xBF]{3}|xF4[x80-x8F][x80-xBF]{2}|[0-9_-])+.)*
# Domain
(?<domain>(?:[x09x0Ax0Dx21-x7E]|[xC2-xDF][x80-xBF]|xE0[xA0-xBF][x80-xBF]|[xE1-xECxEExEF][x80-xBF]{2}|xED[x80-x9F][x80-xBF]|xF0[x90-xBF][x80-xBF]{2}|[xF1-xF3][x80-xBF]{3}|xF4[x80-x8F][x80-xBF]{2}|[0-9_-])+
.
# TLD
(?<tld>biz|com|edu|gov|info|asia|mil|net|int|org|name|mobi|aero|cat|pro|tel|travel|coop|[a-zA-Z]{2}|co.uk|com.au|com.ar|com.mx|com.do|com.my))
)
# path after the fully-qualified domain-name do be discarded
(/.*)?$
/xi
URL_REGEX_SIMPLE = Regexp.new('^https?://.+.(?<tld>[a-z]{2,4})$', true)
url
validation
rails
ruby
(?<fqdn>
# Host part (the first token)
(?<host_dot>(?:[x09x0Ax0Dx21-x7E]|[xC2-xDF][x80-xBF]|xE0[xA0-xBF][x80-xBF]|[xE1-xECxEExEF][x80-xBF]{2}|xED[x80-x9F][x80-xBF]|xF0[x90-xBF][x80-xBF]{2}|[xF1-xF3][x80-xBF]{3}|xF4[x80-x8F][x80-xBF]{2}|[0-9_-])+.)*
# Domain
(?<domain>(?:[x09x0Ax0Dx21-x7E]|[xC2-xDF][x80-xBF]|xE0[xA0-xBF][x80-xBF]|[xE1-xECxEExEF][x80-xBF]{2}|xED[x80-x9F][x80-xBF]|xF0[x90-xBF][x80-xBF]{2}|[xF1-xF3][x80-xBF]{3}|xF4[x80-x8F][x80-xBF]{2}|[0-9_-])+
.
# TLD
(?<tld>biz|com|edu|gov|info|asia|mil|net|int|org|name|mobi|aero|cat|pro|tel|travel|coop|[a-zA-Z]{2}|co.uk|com.au|com.ar|com.mx|com.do|com.my))
)
# path after the fully-qualified domain-name do be discarded
(/.*)?$
/xi
URL_REGEX_SIMPLE = Regexp.new('^https?://.+.(?<tld>[a-z]{2,4})$', true)
february 2012 by phaedrix
Crowd Interactive Tech Blog :: Twitter's Bootstrap in the Asset Pipeline
february 2012 by phaedrix
You can achieve the same thing with the bootstrap-sass gem as explained on this gist.
twitter_bootstrap
less
rails
february 2012 by phaedrix
Memo-what? - A Guide to Memoization | railway
february 2012 by phaedrix
memoization = caching the result of a previous call
memoization
rails
february 2012 by phaedrix
related tags
0.9 ⊕ 1.8 ⊕ 1.9 ⊕ 1.9.3 ⊕ 2.3 ⊕ 2.3.2 ⊕ 3.1 ⊕ 3.2 ⊕ 3.2.1 ⊕ accessors ⊕ acl ⊕ activerecord ⊕ activescaffold ⊕ active_record ⊕ acts_as ⊕ aggregator ⊕ aggregators ⊕ agile ⊕ ajax ⊕ alternatives ⊕ analysis ⊕ analytics ⊕ analyze ⊕ answers ⊕ apache ⊕ api ⊕ apis ⊕ application_controller ⊕ arch ⊕ articles ⊕ assets ⊕ asset_pipeline ⊕ associations ⊕ attr_accessible ⊕ attr_protected ⊕ auth ⊕ authentication ⊕ authlogic ⊕ authorization ⊕ autoloading ⊕ autotest ⊕ azure ⊕ backbone ⊕ bdd ⊕ benchmarks ⊕ best ⊕ bestpractices ⊕ best_practices ⊕ beta ⊕ blog ⊕ blogs ⊕ Bookmarks ⊕ books ⊕ bootstrap ⊕ bugs ⊕ builder ⊕ bundler ⊕ caching ⊕ cakephp ⊕ callback ⊕ callbacks ⊕ cancan ⊕ capistrano ⊕ capybar ⊕ capybara ⊕ career ⊕ case ⊕ cells ⊕ changelog ⊕ charts ⊕ checkout ⊕ churn ⊕ clarity ⊕ clearance ⊕ cli ⊕ cloud ⊕ code ⊕ coding ⊕ coffeescript ⊕ comments ⊕ community ⊕ comparisons ⊕ compass ⊕ compatibility ⊕ conf ⊕ console ⊕ constants ⊕ consulting ⊕ contracting ⊕ contribute ⊕ controllers ⊕ controversy ⊕ core ⊕ creation ⊕ credit_cards ⊕ cron ⊕ crud ⊕ css ⊕ ctags ⊕ cucmber ⊕ cucumber ⊕ culture ⊕ daily ⊕ data ⊕ database ⊕ databases ⊕ database_cleaner ⊕ data_visualization ⊕ date ⊕ debug ⊕ debuggers ⊕ debugging ⊕ declarative_authorization ⊕ delete ⊕ deploy ⊕ deployment ⊕ design ⊕ dev ⊕ development ⊕ devise ⊕ dhh ⊕ diagrams ⊕ discussion ⊕ distribution ⊕ django ⊕ dlr ⊕ docs ⊕ documentation ⊕ dotfiles ⊕ dsls ⊕ ebooks ⊕ email ⊕ embedding ⊕ encoding ⊕ engines ⊕ entrepreneur ⊕ erb ⊕ erd ⊕ errors ⊕ escaping ⊕ essential ⊕ example ⊕ examples ⊕ exceptions ⊕ executable ⊕ extjs ⊕ facebook ⊕ factory_girl ⊕ faking ⊕ feminism ⊕ files ⊕ find ⊕ fixtures ⊕ flash ⊕ flay ⊕ flog ⊕ foreign_keys ⊕ format ⊕ forms ⊕ forums ⊕ frameworks ⊕ freelancing ⊕ frontend ⊕ funny ⊕ gem ⊕ gemfile ⊕ gems ⊕ generator ⊕ geocoding ⊕ gestalt ⊕ getting_started ⊕ git ⊕ github ⊕ global ⊕ gotchas ⊕ gottchas ⊕ gotttchas ⊕ graphviz ⊕ graylog ⊕ group ⊕ growl ⊕ guard ⊕ guidelines ⊕ guides ⊕ habtm ⊕ hackathons ⊕ haml ⊕ harkins ⊕ hasmany ⊕ has_many ⊕ has_many_through ⊕ helpers ⊕ hirb ⊕ hobo ⊕ hosting ⊕ howto ⊕ html ⊕ html_safe ⊕ hypocrisy ⊕ i18n ⊕ ide ⊕ idiocy ⊕ includes ⊕ infosec ⊕ infosec_lists ⊕ inspiration ⊕ integration ⊕ internals ⊕ interviews ⊕ irb ⊕ irbrc ⊕ irc ⊕ issues ⊕ jasmine ⊕ javascript ⊕ jnunemaker ⊕ jobs ⊕ job_market ⊕ job_sites ⊕ joins ⊕ jquery ⊕ jquery-ui ⊕ jquerymobile ⊕ jqueryui ⊕ jrails ⊕ js ⊕ l10n ⊕ lambda ⊕ languages ⊕ layouts ⊕ learn ⊕ learning ⊕ legacy ⊕ less ⊕ less-rails-bootstrap ⊕ libraries ⊕ lift ⊕ lighthouse ⊕ links ⊕ linux ⊕ lists ⊕ log4r ⊕ logger ⊕ logging ⊕ logs ⊕ ls ⊕ mailinglist ⊕ make ⊕ maps ⊕ markdown ⊕ mass_assignment ⊕ memcached ⊕ memoization ⊕ merb ⊕ messages ⊕ metal ⊕ metasearch ⊕ metrics ⊕ microsoft ⊕ middleware ⊕ migrating ⊕ migration ⊕ migrations ⊕ milestones ⊕ mobile ⊕ mobile_fu ⊕ mocking ⊕ mocks ⊕ model ⊕ models ⊕ modules ⊕ mod_rack ⊕ mod_rails ⊕ mongo ⊕ mongodb ⊕ mongoid ⊕ mongrel ⊕ monomapper ⊕ mp3 ⊕ multiple ⊕ mvc ⊕ mysql ⊕ mysql2 ⊕ navigation ⊕ nested ⊕ news ⊕ new_relic ⊕ nginx ⊕ nodejs ⊕ nonfree ⊕ notepad ⊕ notifications ⊕ observer ⊕ online ⊕ optimization ⊕ oreilly ⊕ oss ⊕ other_code ⊕ output ⊕ overview ⊕ pagination ⊕ paperclip ⊕ papertrail ⊕ partials ⊕ passenger ⊕ paths ⊕ patterns ⊕ payments ⊕ people ⊕ performance ⊕ php ⊕ phusion_passenger ⊕ pino ⊕ plugin ⊕ plugins ⊕ podcast ⊕ podcasts ⊕ portland ⊕ post ⊕ postgres ⊕ postrank ⊕ posts ⊕ pragmatic ⊕ preload ⊕ pretty ⊕ processing ⊕ production ⊕ programmers ⊕ programming ⊕ projects ⊕ project_mgmt ⊕ prototype ⊕ pry ⊕ quality ⊕ quickref ⊕ rack ⊕ railcat ⊕ rails ⊖ rails2 ⊕ rails3 ⊕ railscasts ⊕ rails_rumble ⊕ railtie ⊕ railties ⊕ rake ⊕ ranking ⊕ ransack ⊕ rants ⊕ rcov ⊕ rdoc ⊕ reddit ⊕ redis ⊕ reek ⊕ refactoring ⊕ reference ⊕ relations ⊕ releases ⊕ reload ⊕ remarkable ⊕ render ⊕ repo ⊕ repos ⊕ repositories ⊕ repository ⊕ rescue_from ⊕ resources ⊕ rest ⊕ resume ⊕ roles ⊕ roodi ⊕ ror ⊕ routes ⊕ rspec ⊕ rss ⊕ rsyslog ⊕ ruby ⊕ rubyonrails ⊕ rumble ⊕ saas ⊕ saikuro ⊕ sass ⊕ scaffold ⊕ scaffolding ⊕ scalability ⊕ scaling ⊕ scopes ⊕ screen ⊕ screencasts ⊕ scrolling ⊕ search ⊕ security ⊕ seed_data ⊕ selenium ⊕ send_file ⊕ serialize ⊕ setup ⊕ sexism ⊕ shoulda ⊕ silverlight ⊕ single_table_inheritance ⊕ sites ⊕ skeleton ⊕ skeletons ⊕ slides ⊕ slideshare ⊕ smells ⊕ so ⊕ social_networking ⊕ solutions ⊕ source ⊕ spec ⊕ specjour ⊕ specs ⊕ speed ⊕ sphinx ⊕ spork ⊕ sql ⊕ src ⊕ ssl ⊕ stackoverflow ⊕ stack_overflow ⊕ staging ⊕ standalone ⊕ start ⊕ starter ⊕ startup ⊕ statistics ⊕ stats ⊕ sti ⊕ store ⊕ stories ⊕ stubs ⊕ suckage ⊕ suspenders ⊕ syntax ⊕ syslog ⊕ syslogger ⊕ sysloglogger ⊕ tabs ⊕ taps ⊕ tdd ⊕ telecommute ⊕ template ⊕ templates ⊕ templating ⊕ testing ⊕ tests ⊕ testunit ⊕ textmate ⊕ theme ⊕ themes ⊕ theming ⊕ thinking_sphinx ⊕ threads ⊕ tickets ⊕ time ⊕ timezone ⊕ tips ⊕ toolbox ⊕ tools ⊕ tricks ⊕ troubleshooting ⊕ tutorial ⊕ tutorials ⊕ twitter ⊕ twitter-bootstrap-rails ⊕ twitter_bootstrap ⊕ ujs ⊕ unobtrusive ⊕ upgrade ⊕ upgrading ⊕ uploads ⊕ url ⊕ ux ⊕ validation ⊕ variables ⊕ vcddb ⊕ vcr ⊕ vids ⊕ view ⊕ views ⊕ vim ⊕ visualization ⊕ vulnerabilities ⊕ watchr ⊕ web ⊕ webdev ⊕ webmock ⊕ webrat ⊕ web_design ⊕ whitepapers ⊕ widgets ⊕ wiki ⊕ will_paginate ⊕ windows ⊕ wizards ⊕ work ⊕ wycats ⊕ xaml ⊕ xss ⊕ yahoopipes ⊕ yaml ⊕ yard ⊕ yardoc ⊕ zedshaw ⊕ _why ⊕Copy this bookmark: