Skip to content

Instantly share code, notes, and snippets.

View multiplier's full-sized avatar

John Kamuchau multiplier

View GitHub Profile
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@multiplier
multiplier / installation
Created April 11, 2012 04:17
Common Installation procedures
Running and install of twitter bootstrap rails
rails g bootstrap:install
rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
Running Rspec installation
group :development, :test do
gem 'turn'
gem 'rspec-rails'
gem 'capybara'
gem 'factory_girl_rails'
@multiplier
multiplier / oauth_controller.rb
Created February 13, 2012 12:13 — forked from dblock/oauth_controller.rb
An updated OAuth2 controller for a Rails app (implies you have ClientApplication and AccessGrant)
class OauthController < ApplicationController
class ApiOAuthError < StandardError
attr_accessor :code, :description, :uri, :state
def initialize(code, description, uri = nil, state = nil)
@code = code
@description = description
@uri = uri
if ($handle = fopen($csv_file, 'r'))
{
$all_headings = array_unique(explode(',', trim(fgets($handle))));
foreach ($all_headings as $heading)
{
if ( ! $heading)
{
break;
}
@multiplier
multiplier / Bread_crumb
Created March 17, 2011 04:34
Bread_crumb menu manager
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* @package Bread_crumb
* @author John Kamuchau , info@webflame.com.au
* @copyright Copyright (c) 2009, Web Flame , www.webflame.com.au/
* @license http://www.webflame.com.au/
* @link http://www.webflame.com.au/
* @since Version 1.0
* @filesource