This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Burn::ControllerBase::REST; | |
use Moose; | |
use namespace::autoclean; | |
BEGIN { extends qw/Catalyst::Controller::REST/ } | |
__PACKAGE__->config( | |
'default' => 'text/html', | |
map => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#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>'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub parent { | |
my $self = shift; | |
my $pcol = $self->parent_column; | |
return $self->result_source->resultset->find( | |
$self->get_column ($pcol) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $chief = $rs->create( | |
{ | |
name => 'grand chief', | |
children => [ | |
{ | |
name => 'subordinate 1', | |
children => [ map { { name => 'rookie 1.' . $_ } } qw/1 2 3/, ], | |
}, | |
{ | |
name => 'subordinate 2', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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": |