Skip to content

Instantly share code, notes, and snippets.

@bacoords
bacoords / grab_vimeo_thumbnail.php
Last active October 1, 2024 08:59
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 ) );
@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
*/
@harlanhaskins
harlanhaskins / Parser.swift
Last active July 18, 2021 02:47
Building a Compiler in Swift with LLVM, Part 2: AST and the Parser
#if os(macOS)
import Darwin
#elseif os(Linux)
import Glibc
#endif
// MARK: Tokens
enum BinaryOperator: Character {
case plus = "+"
@hubgit
hubgit / Attachment.php
Last active January 11, 2018 00:00
Symfony service to subscribe to VichUploaderBundle's POST_UPLOAD event. Saves file details as new entity fields. Note: untested since pasting and editing, may not work as-is.
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
<?php
namespace NoxLogic\DemoBundle\Form\Type;
use Doctrine\ORM\EntityManager;
use NoxLogic\DemoBundle\Entity\Province;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
@plentz
plentz / nginx.conf
Last active November 16, 2024 14:10
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ogrrd
ogrrd / Cake Composer.md
Last active July 15, 2024 22:03
Install Cake 2.x with Composer

Install CakePHP 2.x with Composer

Remove the main CakePHP lib directory

$ cd /path/to/your/website
$ rm -Rf ./lib

Add the following composer.json file

@ogrrd
ogrrd / Mac Dev Setup.md
Last active November 12, 2020 22:16
Installing nginx, PHP and MySQL on OS X Mavericks

Installing a Web Developer setup on OS X Mavericks

Install Command Line Tools

This is a requirement for brew in the next step. You can install XCode and then install Command Line Tools through the XCode preferences, or you can install just the Command Line Tools.

Install Command Line Tools

$ xcode-select --install
@lbdremy
lbdremy / click-reference-affiliate-networks.md
Last active December 4, 2023 16:14
click reference parameter in a bunch of affiliate networks. Feel free to contribute, add and remove errors.

- Affiliate network name - &parameter=value_of_the_click_reference_here_CLICKREF

  • Advortis - &xref1=CLICKREF
  • Affiliate Future - &tracking=CLICKREF
  • Affiliate Window - &clickref=CLICKREF
  • Affilinet - &subid=CLICKREF
  • Aflite - &aref=CLICKREF
  • Brand Conversions - &subid=CLICKREF
  • Buyat - &LID=CLICKREF
  • Carpet Right Affiliates - &link_ref=CLICKREF
  • ClixGalore - &OID=CLICKREF