Skip to content

Instantly share code, notes, and snippets.

use strict;
use warnings;
use Test::More;
use lib "t/lib";
use Schema;
my $schema = Schema->connect('dbi:SQLite::memory:');
$schema->deploy;
my $rs = $schema->resultset('Test');
package Burn::ControllerBase::REST;
use Moose;
use namespace::autoclean;
BEGIN { extends qw/Catalyst::Controller::REST/ }
__PACKAGE__->config(
'default' => 'text/html',
map => {
$("#add-row").click(function(){
var size = $(".workout-rows").length;
//size += 1;
var row ='<tr class="workout-rows">' +
'<td><input type="text" name="workout[exercise][' + size + '][name]" /></td>' +
'<td><input type="text" name="workout[exercise][' + size + '][repetitions]" size="3"/></td>'+
'<td><input type="text" name="workout[exercise][' + size + '][sets]" size="3"/></td>' +
'<td><input type="text" name="workout[exercise][' + size + '][weight]" size="4"/></td>' +
'</tr>';
sub parent {
my $self = shift;
my $pcol = $self->parent_column;
return $self->result_source->resultset->find(
$self->get_column ($pcol)
);
}
# example url: /dashboard/$charttype/$username/$style/$stats_for/$range/$days_months_or_years/$delimiter_day_week_or_month
# url i'm using: http://localhost:3000/dashboard/urmom/stats/months/3/daily/total/graph/subscribers
sub index : Local {
my ( $self, $c, $channel ) = @_;
my @args = @{$c->req->args};
$c->log->debug("Args: " . @args);
my $display = shift @args || 'graph';
my $style = shift @args || 'incr';
my $stat = shift @args || 'subscribers';
my $chief = $rs->create(
{
name => 'grand chief',
children => [
{
name => 'subordinate 1',
children => [ map { { name => 'rookie 1.' . $_ } } qw/1 2 3/, ],
},
{
name => 'subordinate 2',
## some names changed
Caught exception in MyApp::Controller::Dashboard->index "Can't locate object method "overall_ranking_num" via package "MyApp::Model::DB::Rankings" at /...../lib/MyApp/Controller/Dashboard.pm line 132."
## controller code:
## $channel isa MyApp::Schema::Result::DB::Profiles
$channel->ranking->overall_ranking_num( $channel, $stat, 6 );
package MyApp::Schema::DB::ResultSet::Rankings;
use strict;
admins-MacBook-Pro:DBIx-Class-Tree-Recursive admin$ prove -lv t/
t/basic.t ..
ok 1 - initial state
ok 2 - chief has no parent
ok 3 - first subordinate
ok 4 - first subordinate has chief as parent
ok 5 - second subordinate
ok 6 - second subordinate has chief as parent
ok 7 - first child
ok 8 - child 1 has subordinate 1 as a parent
$(function() {
var lastsel;
var rowid;
var rows = $("#tposts").jqGrid('getDataIDs');
console.log("rows: " + rows);
$("#tposts").jqGrid({
url:'/user/' + [% c.user.get("userid") %] + "/entries/all",
datatype: "json",
mtype: "GET",
@dhoss
dhoss / puppet NFS
Created December 24, 2010 04:56 — forked from eqhmcow/puppet NFS
# modules/nfs/manifests/init.pp
class nfs_server {
file { "destroy_exports":
path => "/etc/exports.puppet",
ensure => present,
source => "puppet://$servername/modules/nfs/empty",
}
package { "portmap":