Skip to content

Instantly share code, notes, and snippets.

<?php $contain = array(
'Module' => array(
'Question' => array(
'Answer',
'order' => 'RAND()',
'limit' => 15
),
'order' => array('order','name')
)
);
def update
@company = Company.find(params[:id])
# @company.user = current_user
@company.projects.each do |p|
if p.user.nil?
p.user = current_user
end
end
<div class="root-box">
<h1><%= link_to 'Companies', companies_path %></h1>
<div class="company-box">
<h1><%= h @company.name %></h1>
<% if !@company.user.nil? %>
<h2><%= h @company.user.username %></h2>
<% end %>
<%= link_to 'Edit', edit_company_path(@company) %>
<?php
/**
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
<html>
<head>
<script type="application/javascript">
var blts = [];c=100;w=800;h=600;f=0;fps=40;
function rd(a){return Math.floor(Math.random()*a)};
function neg(a){if (a < 0){return -1}else{return 1}}
function draw() {
var canvas = document.getElementById("canvas");
if (canvas.getContext) {
@jlebrech
jlebrech / BBQCode
Created October 1, 2010 13:32
BBQCode
{Slash} the [chicken legs] all over with a knife. {Pick} the [cilantro leaves] and put them to one side. Add the [stalks] to a <food processor> with the rest of the ingredients and {whizz} to make a paste.
<?php
class Contact_model extends Model {
function Contact_model()
{
parent::Model();
}
}
<?php
class Contact extends Controller {
function Contact()
{
parent::Controller();
$this->load->helper(array('form','url','html','email'));
$this->load->library(array('tank_auth','Jquery_pagination','form_validation'));
}
$status_options = array();
foreach($statuses as $status){
$status_options[$status->id]=$status->name;
}
$this->db->where('id',$contact_id);
$this->db->where('status_id',"1");
$query = $this->db->from('contacts');
echo $this->db->last_query();