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
Please improve
Snake / Nibbles clone in C and Ncurses
List the files in a directory without the directory name or the extension
Convert simple Javascript to jQuery plugin
Simple Particle Engine for a shooter game
Active Record getting unique records
Breadth first cartesian product iterator
php refactoring
first BST
Pastable version of
Typical restful scaffold controller
<pre class='prettyprint' language='ruby'>class PostsController < ApplicationController before_filter :find_post, :only => [:show, :edit, :update, :destroy] def index @posts = Post.find(:all) end def show end def new @post = Post.new end def edit end def create @post = Post.new(params[:post]) if @post.save flash[:notice] = ‘Post was successfully created.‘ redirect_to post_url(@post) else render :action => "new" end end def update if @post.update_attributes(params[:post]) flash[:notice] = ‘Post was successfully updated.‘ redirect_to post_url(@post) else render :action => "edit" end end def destroy @post.destroy redirect_to posts_url end private def find_post @post = Post.find(params[:id]) end end</pre> <a href="http://www.refactormycode.com/codes/1-typical-restful-scaffold-controller" 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>