Skip to content

Instantly share code, notes, and snippets.

View multiplier's full-sized avatar

John Kamuchau multiplier

View GitHub Profile
@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 , [email protected]
* @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
if ($handle = fopen($csv_file, 'r'))
{
$all_headings = array_unique(explode(',', trim(fgets($handle))));
foreach ($all_headings as $heading)
{
if ( ! $heading)
{
break;
}
@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
@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'
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 / deploy.rb
Created June 25, 2012 16:37 — forked from robzolkos/deploy.rb
deploy.rb for Linode
#$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require 'bundler/capistrano'
require 'rvm/capistrano'
require "capistrano_colors"
require 'thinking_sphinx/deploy/capistrano'
require 'delayed/recipes'
set :normalize_asset_timestamps, false
set :rvm_type, :user
set :rvm_ruby_string, 'ruby-1.9.3-p125@appname'
@multiplier
multiplier / gist:3630835
Created September 5, 2012 05:03 — forked from 23inhouse/gist:3594808
Customizing simple_form and bootstrap

Customization

  <%= f.input :state, :collection => ['SA', 'WA'] %>
  <%= f.input :state,
              :as => :radio_buttons,
@multiplier
multiplier / gist:3631239
Created September 5, 2012 05:50 — forked from 23inhouse/gist:3594808
Customizing simple_form and bootstrap

Customization

  <%= f.input :state, :collection => ['SA', 'WA'] %>
  <%= f.input :state,
              :as => :radio_buttons,
@multiplier
multiplier / example.js
Created September 15, 2012 16:44 — forked from jaimeiniesta/example.js
jQuery-UI autocomplete with multiple comma-separated values from a JSON remote source
$(function() {
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
$( "#new_interest" ).autocomplete({
@multiplier
multiplier / gist:4141546
Created November 24, 2012 21:57
backbonejserror
class Trainer.Views.LessonsIndex extends Backbone.View
template: JST['lessons/index']
initialize: ->
@collection.on('reset', @render, this);
@collection.on('add', @render, this);
render: ->
$(@el).html(@template(lessons: @collection))