This file contains hidden or 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
{# | |
time can be any string acceptable by http://www.php.net/strtotime, the | |
template will output that time's month. | |
If you don't want to pass in a date you can set time like this: | |
{% set time = "now"|date("U") %} | |
{% set time = "December 2012"|date("U") %} | |
Data (in activityByDay) is collated by activityByDay[year][month][day], which holds a list | |
of activity data for each day. YMMV for your own needs. |
This file contains hidden or 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
# This is pretty much pilfered from: http://twig.sensiolabs.org/doc/recipes.html#using-a-database-to-store-templates | |
# and then modified to use a given strings for templates instead of fetching from the database... even simpler! | |
# The loader as a component: | |
class TwigString implements \Twig_LoaderInterface { | |
public function getSource($name) | |
{ | |
// get from database |
This file contains hidden or 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( $ ) { | |
$(function() { | |
$('.vcard-download').click(function() { | |
// Get the vcard data stored within the same result container | |
var vcard = $('#vcard'); | |
// Generate a filename that is the person's fullname with all whitespace converted to dashes. | |
var filename = vcard.data('displayname').replace(/\s+/, '-') + '.vcf'; | |
// Initiate the download of the data as a file | |
download(vcard.html(), filename, 'text/vcard'); | |
}); |