Skip to content

Instantly share code, notes, and snippets.

@account.feed_posts.each do |post|
puts 'init: '+post.user.inspect
end
<div id="profile_summary_tile">
{{#user}}
<h2>{{username}}</h2>
<ul id="metadata">
<li>Views: {{views}}</li>
<li>Votes: {{vote_count}}</li>
<li>Rating: {{rating_cache}}</li>
</ul>
<ul id="user_actions">
{{^is_friend?}}<li><a href="user/friend/add?username={{username}}">Become friends</a></li>{{/is_friend?}}
module Picombo
module Stache
class User_View < Mustache
self.template = File.open(Picombo::Core.find_file('views', 'user/view', true, 'mustache').shift).read
@user = nil
def initialize
Picombo::Head.add_js('js/jquery.js')
Picombo::Head.add_js('js/effects.js')
diff --git a/classes/kohana/request.php b/classes/kohana/request.php
index d739056..a639c48 100644
--- a/classes/kohana/request.php
+++ b/classes/kohana/request.php
@@ -988,7 +988,7 @@ class Kohana_Request {
if ($this !== Request::$instance)
{
// Add the parent request uri
- $benchmark .= ' « "'.Request::$current->uri.'"';
+ $benchmark .= ' « "'.(NULL == Request::$current ? '<empty uri>' : Request::$current->uri).'"';
<?php
/**
* The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file.
*
* @see http://kohanaframework.org/guide/about.install#system
*/
$system = '.';
diff --git a/classes/kohana/core.php b/classes/kohana/core.php
index 7b6eeb8..8f40260 100644
--- a/classes/kohana/core.php
+++ b/classes/kohana/core.php
@@ -1438,7 +1438,7 @@ class Kohana_Core {
// Introspection on closures in a stack trace is impossible
$params = NULL;
}
- else
+ elseif (function_exists($step['function']))
Picombo::Router.add('_default', 'home/index')
Picombo::Router.add('index', 'home/index')
Picombo::Router.add('friends', 'user/friends')
Picombo::Router.add('saved', 'user/saved')
Picombo::Router.add(Regexp.new(/photo-comments\/([0-9]+).json/), "image/comments/\\1")
Picombo::Router.add('html route', lambda{ |path|
if Regexp.new('(.+).html').match(path)
parts = Regexp.last_match[1].split('/')
{:controller => parts[0], :method => parts[1], :params => parts[2..-1]}
end
@zombor
zombor / kohana-release.sh
Created March 11, 2011 04:44
Kohana Release Script - Bash script to do a kohana release from git.
#!/bin/bash
MAJOR_VERSION=$1
MINOR_VERSION=$2
if [ $# -lt 2 ]
then
echo "Usage: $0 <MAJOR-VERSION> <MINOR-VERSION>"
exit
fi
#!/bin/sh
VIDEODIR=$1
FILENAME=$2
CHANID=$3
STARTTIME=$4
# Sanity checking, to make sure everything is in order.
if [ -z "$VIDEODIR" -o -z "$FILENAME" -o -z "$CHANID" -o -z "$STARTTIME" ]; then
echo "Usage: $0 <VideoDirectory> <FileName> <CHANID> <STARTTIME>"
fi
if [ ! -f "$VIDEODIR/$FILENAME" ]; then
@zombor
zombor / deploy.rb
Created March 21, 2011 18:05
zombor's capistrano deploy scripts
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
# --------------------------------------------
# Repository
# --------------------------------------------
set :scm, :git # I am using git, so I specify it here
set :repository, "<repo>" # This is the path to the repository on the server, we pushed the code here earlier.