Skip to content

Instantly share code, notes, and snippets.

@instabledesign
instabledesign / DateTimeNotConvertable.php
Last active August 5, 2019 18:35
[Doctrine] Convert the DateTime to store it in UTC DateTime.
#src/AppBundle/Doctrine/DBAL/DateTimeNotConvertable.php
<?php
namespace AppBundle\Doctrine\DBAL;
/**
* Class DateTimeNotConvertable
* This class was use to skip the automatic DBAL DateTimeUTC transformation
* see AppBundle\Doctrine\DBAL\Types\UTCDateTimeType
*/
@bacoords
bacoords / grab_vimeo_thumbnail.php
Last active June 18, 2025 19:52
Grab a thumbnail of a private (but embeddable) Vimeo video
<?php
/**
* Grab the url of a publicly embeddable video hosted on vimeo
* @param str $video_url The "embed" url of a video
* @return str The url of the thumbnail, or false if there's an error
*/
function grab_vimeo_thumbnail($vimeo_url){
if( !$vimeo_url ) return false;
$data = json_decode( file_get_contents( 'http://vimeo.com/api/oembed.json?url=' . $vimeo_url ) );