Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
Simple Particle Engine for a shooter game
Snake / Nibbles clone in C and Ncurses
Please improve
Parsing of XML data has high CPU usage
Convert simple Javascript to jQuery plugin
Active Record getting unique records
List the files in a directory without the directory name or the extension
clean the code
ohs system, recruitment software, hr software, oh&s software, human resources software, ohs software
Array parsing in a block
Popular
Parsing of XML data has high CPU usage
Snake / Nibbles clone in C and Ncurses
Please improve
List the files in a directory without the directory name or the extension
Convert simple Javascript to jQuery plugin
Active Record getting unique records
Simple Particle Engine for a shooter game
Breadth first cartesian product iterator
php refactoring
first BST
Pastable version of
Password update code
<pre class='prettyprint' language='ruby'>class AccountsController < ApplicationController layout 'application' before_filter :login_required, :except => :show # Change password action def update return unless request.put? # we authenticate with email if Dj.authenticate(current_dj.email, params[:old_password]) if ((params[:password] == params[:password_confirmation]) && !params[:password_confirmation].blank?) current_dj.password_confirmation = params[:password_confirmation] current_dj.password = params[:password] if current_dj.save flash[:notice] = "Password successfully updated." redirect_to dj_path(current_dj.login) #profile_url(current_dj.login) else flash[:error] = "An error occured, your password was not changed." render :action => 'edit' end else flash[:error] = "New password does not match the password confirmation." @old_password = params[:old_password] render :action => 'edit' end else flash[:error] = "Your old password is incorrect." render :action => 'edit' end end end</pre> <a href="http://www.refactormycode.com/codes/373-password-update-code" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>