Skip to content

Instantly share code, notes, and snippets.

@JEEN
Created July 25, 2012 07:13
Show Gist options
  • Select an option

  • Save JEEN/3174880 to your computer and use it in GitHub Desktop.

Select an option

Save JEEN/3174880 to your computer and use it in GitHub Desktop.
Export Facebook Event Attendees
use strict;
use warnings;
use Text::Xslate;
use Data::Section::Simple;
use Facebook::Graph;
my $fb = Facebook::Graph->new;
$fb->access_token("YOUR ACCESS TOKEN");
my $r = $fb->fetch('466164950078338/attending');
my @attendees;
for my $person (@{ $r->{data} }) {
my $f = $fb->fetch($person->{id});
$f->{profile_image} = $fb->picture($person->{id})->get_large->uri_as_string;
push @attendees, $f;
}
push @attendees, {} for (1..3);
my $tx = Text::Xslate->new(
syntax => 'TTerse',
module => [ 'Text::Xslate::Bridge::TT2Like', 'HTML::Entities' ],
path => [
Data::Section::Simple->new()->get_data_section()
],
);
print $tx->render('template.tx', { attendees => \@attendees });
__DATA__
@@ template.tx
<html>
<head>
<title>#perl-kr 티타임 #2 참가자</title>
<style>
[% INCLUDE "css.tx" %]
</style>
</head>
<body>
<h1>※ #perl-kr 티타임 #2 참가명단</h1>
<table class="table table-striped table-bordered" style="width:50%">
<thead>
<tr>
<th class="span1">&nbsp;</th>
<th class="span2">&nbsp;</th>
<th class="span2">Name</th>
<th class="span1">Attend?</th>
</tr>
</thead>
<tbody>
[% FOREACH p IN attendees %]
<tr>
<td>[% loop.count %]</td>
<td><img src="[% p.profile_image %]" width="60" height="60" /></td>
<td>[% p.name %][% IF p.username %]([% p.username %])[% END %]</td>
<td></td>
</tr>
[% END %]
</tbody>
</table>
</body>
</html>
@@ css.tx
table {
max-width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
/* line 19, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table {
width: 100%;
margin-bottom: 18px;
}
/* line 23, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table th, .table td {
padding: 8px;
line-height: 18px;
text-align: left;
vertical-align: top;
border-top: 1px solid #ddd;
}
/* line 30, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table th {
font-weight: bold;
}
/* line 34, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table thead th {
vertical-align: bottom;
}
/* line 38, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table thead:first-child tr th, .table thead:first-child tr td {
border-top: 0;
}
/* line 42, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table tbody + tbody {
border-top: 2px solid #ddd;
}
/* line 53, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-condensed th, .table-condensed td {
padding: 4px 5px;
}
/* line 62, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-bordered {
border: 1px solid #ddd;
border-collapse: separate;
*border-collapse: collapsed;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
/* line 67, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-bordered th + th, .table-bordered td + td, .table-bordered th + td, .table-bordered td + th {
border-left: 1px solid #ddd;
}
/* line 71, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-bordered thead:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child td {
border-top: 0;
}
/* line 75, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-bordered thead:first-child tr:first-child th:first-child, .table-bordered tbody:first-child tr:first-child td:first-child {
-webkit-border-radius: 4px 0 0 0;
-moz-border-radius: 4px 0 0 0;
border-radius: 4px 0 0 0;
}
/* line 78, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-bordered thead:first-child tr:first-child th:last-child, .table-bordered tbody:first-child tr:first-child td:last-child {
-webkit-border-radius: 0 4px 0 0;
-moz-border-radius: 0 4px 0 0;
border-radius: 0 4px 0 0;
}
/* line 82, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-bordered thead:last-child tr:last-child th:first-child, .table-bordered tbody:last-child tr:last-child td:first-child {
-webkit-border-radius: 0 0 0 4px;
-moz-border-radius: 0 0 0 4px;
border-radius: 0 0 0 4px;
}
/* line 85, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-bordered thead:last-child tr:last-child th:last-child, .table-bordered tbody:last-child tr:last-child td:last-child {
-webkit-border-radius: 0 0 4px 0;
-moz-border-radius: 0 0 4px 0;
border-radius: 0 0 4px 0;
}
/* line 97, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table-striped tbody tr:nth-child(odd) td, .table-striped tbody tr:nth-child(odd) th {
background-color: #f9f9f9;
}
/* line 108, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
.table tbody tr:hover td, .table tbody tr:hover th {
background-color: #f5f5f5;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span1 {
float: none;
width: 44px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span2 {
float: none;
width: 124px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span3 {
float: none;
width: 204px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span4 {
float: none;
width: 284px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span5 {
float: none;
width: 364px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span6 {
float: none;
width: 444px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span7 {
float: none;
width: 524px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span8 {
float: none;
width: 604px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span9 {
float: none;
width: 684px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span10 {
float: none;
width: 764px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span11 {
float: none;
width: 844px;
margin-left: 0;
}
/* line 124, ../../../../../../.rvm/gems/ruby-1.9.2-p290/gems/bootstrap-sass-2.0.1/vendor/assets/stylesheets/bootstrap/_tables.scss */
table .span12 {
float: none;
width: 924px;
margin-left: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment