[Jifty-commit] r3106 - in jifty/trunk: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Apr 6 12:10:56 EDT 2007
Author: jesse
Date: Fri Apr 6 12:10:56 2007
New Revision: 3106
Modified:
jifty/trunk/ (props changed)
jifty/trunk/doc/talks/present-slides
jifty/trunk/doc/talks/yapc.asia.2007.txt
Log:
r54522 at dhcp207: jesse | 2007-04-06 21:37:27 +0900
* Talk updates
Modified: jifty/trunk/doc/talks/present-slides
==============================================================================
--- jifty/trunk/doc/talks/present-slides (original)
+++ jifty/trunk/doc/talks/present-slides Fri Apr 6 12:10:56 2007
@@ -59,19 +59,19 @@
`$cmd>/dev/null 2>/dev/null &`;
$slides_played->{$counter}++}
}
- if ( $slide =~ s/#\s*mode.*?perl.*?$//gms ) {
- $mode = 'perl';
+ if ( $slide =~ s/#\s*mode.*?(perl|ruby).*?$//gms ) {
+ $mode = $1;
}
if ( $mode eq 'text' and $slide ) {
$slide = autoformat $slide, { left => 2, right => ($cols-1), all => 1 };
}
- elsif ($mode eq 'perl') {
+ elsif ($mode =~ /(?:perl|ruby)/) {
$slide =~ s/^/ /gsm;
my $tidycols = $cols - 2; # squeeze for display
open my $out , ">/tmp/output.$$" || die $!;
print $out $slide || die $!;
close $out || die $!;
- $slide = ` cat /tmp/output.$$ | source-highlight -s perl -f esc`;
+ $slide = ` cat /tmp/output.$$ | source-highlight -s $mode -f esc`;
#$slide = ` cat /tmp/output.$$ | perltidy -q -l $tidycols| source-highlight -s perl -f esc`;
}
@@ -94,7 +94,8 @@
$console->Cursor( 0, ( $rows - 1 ) );
print colored("$counter/" . $#SLIDES, "bold white");
if ($translation) {
- $console->Cursor( 10 , ( $rows - 1 ) );
+ my $start = int ( ( $cols / 2 ) - ( length($translation) / 2 ) );
+ $console->Cursor( $start , ( $rows - 1 ) );
print colored($translation, "bold yellow on black");
}
ReadMode 4;
Modified: jifty/trunk/doc/talks/yapc.asia.2007.txt
==============================================================================
--- jifty/trunk/doc/talks/yapc.asia.2007.txt (original)
+++ jifty/trunk/doc/talks/yapc.asia.2007.txt Fri Apr 6 12:10:56 2007
@@ -3,7 +3,6 @@
---
#title A bit about DSLs
DSLs are little languages for specific programming tasks
-# loc-ja This is a test
---
DSLs are easier to read
---
@@ -221,10 +220,9 @@
---
<obra> shit! it actually works!
---
-
What we had left:
-
-the field foo => sub {}; issue
+---
+the "field foo => sub {};" issue
---
#mode perl
@@ -265,7 +263,6 @@
---
#title In the end...
-
We ended up with Jifty::DBI columns
---
#mode perl
@@ -284,7 +281,7 @@
valid are formatted_timezones();
};
---
-Implemented it twice
+We implemented the DSL twice
---
#title
Take 1
@@ -350,8 +347,10 @@
since(is('0.0.7'));
---
Downsides
-- Limited flexibility
-- Needs new functions for every attribute
+---
+Limited flexibility
+---
+Needs new functions for every attribute
---
#title Take 2
#`mpg123 ~/katamari.mp3`
@@ -431,6 +430,22 @@
}
};
---
+#mode perl
+template choices => page {
+ h1 { 'My Choices' }
+ dl {
+ my $choices = Doxory::Model::ChoiceCollection->new;
+ $choices->limit(
+ column => 'asked_by',
+ value => Jifty->web->current_user->id,
+ );
+ while (my $c = $choices->next) {
+ dt { $c->name, ' (', $c->asked_by->name, ')' }
+ dd { b { $c->a } em { 'vs' } b { $c->b } }
+ }
+ }
+};
+---
But!
---
Content! Templates!
@@ -449,7 +464,7 @@
---
It's 2007
---
-People use CSS for design now.
+People use CSS for design now
---
Programmers still have to make templates
---
@@ -505,7 +520,7 @@
---
But where do we put these?
---
-We need a global stash.
+We need a global stash
---
It needs to be per package
(Don't want to mix things together)
@@ -521,8 +536,8 @@
Actually, Perl doesn't care
---
#mode perl
- no strict 'refs';
- *{ $class . '::' . $subname } = $coderef;}
+no strict 'refs';
+*{ $class . '::' . $subname } = $coderef;
---
That just works.
---
@@ -530,8 +545,9 @@
---
But how do you call it?
---
+#mode perl
# perldoc UNIVERSAL
-
+---
CLASS->can( METHOD )
"can" checks if the object or class has a method called "METHOD".
If it does then a reference to the sub is returned.
@@ -539,12 +555,14 @@
#title Closures
Now, about that syntax.
---
-HTML tags take blocks of content.
+HTML tags take blocks of content
---
-Our tag methods take blocks of perl.
+Our tag methods take blocks of Perl
---
They return closures when you want them to
---
+They run and output their content when you want them to
+---
#mode perl
sub h1 (&;$) {
my $code = shift;
@@ -555,10 +573,11 @@
return sub { ...closure around $code...};
} else {
# Actually do our work, run $code and return the output
+ return $code->();
}
}
---
-We install methods for ever HTML tag
+We install methods for every HTML tag
---
(Except 'tr'. Anybody know why?)
---
@@ -578,9 +597,8 @@
# mode perl
# What we've got:
-div {
- attr { id => 'my-div'};
- ...
+div { attr { id => 'my-div'};
+ ...
};
# and
@@ -598,10 +616,9 @@
---
So, what's the big problem?
---
-Just change the prototype.
+Just change the prototype
---
-In Perl, the (&) in a prototype
-may ONLY come first.
+In Perl, the (&) in a prototype MUST come first
---
ORZ
---
More information about the Jifty-commit
mailing list