Skip to content

Instantly share code, notes, and snippets.

@merk
merk / Customer.php
Created June 6, 2012 10:41
ResolveTargetEntityListener examples
<?php
// src/Acme/AppBundle/Entity/Customer.php
namespace Acme\AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Acme\CustomerBundle\Entity\Customer as BaseCustomer;
use Acme\InvoiceBundle\Model\InvoiceSubjectInterface;
@sergeylukin
sergeylukin / post-receive
Last active April 27, 2018 13:38
Git hook (post-receive): update working tree on PUSH
#!/bin/sh
#
# This hook is placed in Bare repository and it updates Working tree whenever a PUSH
# is executed
#
# Assuming following file structure:
# .
# |-- myproject
# |-- myproject.git
# set WORKTREE=../myproject
@atomicpages
atomicpages / fbUrlCheck.php
Created January 24, 2013 09:37
A simple facebook URL checker RegEx for PHP or JavaScript
<?php
/**
* A simple regex to test whether or not a facebook url is valid. For basic usage, this will do the job.
* @see Test cases <http://ideone.com/ZMJp4f>
*/
$fbUrlCheck = '/^(https?:\/\/)?(www\.)?facebook.com\/[a-zA-Z0-9(\.\?)?]/';
$secondCheck = '/home((\/)?\.[a-zA-Z0-9])?/';
$validUrl = 'https://www.facebook.com/atomicpages/';
@floptwo
floptwo / php-cli_ovh_mutu.md
Last active April 25, 2023 08:40
OVH PHP-CLI

PHP-CLI (PHP en ligne de commande) sur les hébergements mutualisés OVH

More complete info here http://cluster015.ovh.net/infos/ (thanks to @42antoine)

(cli)

/usr/local/php5.3/bin/php => PHP 5.3.29 (cli) (built: Nov 21 2017 08:55:07)
/usr/local/php5.4/bin/php => PHP 5.4.45 (cli) (built: Nov 21 2017 08:35:51)
/usr/local/php5.5/bin/php => PHP 5.5.38 (cli) (built: Nov 21 2017 08:46:45)
@lukaswhite
lukaswhite / elasticsearch-on-homestead.txt
Created August 3, 2014 08:58
Installing Elasticsearch on Laravel Homestead
# Install Java
sudo apt-get install openjdk-7-jre-headless -y
# Download & install the Public Signing Key
wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
# Add the following to /etc/apt/sources.list
deb http://packages.elasticsearch.org/elasticsearch/1.3/debian stable main
# Update Aptitude
@postspectacular
postspectacular / gist:453c72b62f47d870cce0
Created November 5, 2014 14:32
ffmpeg animated gif (optionally w/ watermark)
# 12fps resize to 640x360
ffmpeg -f image2 -r 12 -i frame-%04d.png -pix_fmt rgb24 -r 12 -s 640x360 anim.gif
# with watermark
ffmpeg -f image2 -r 12 -i frame-%04d.png -pix_fmt rgb24 -r 12 -s 640x360 -vf "movie=credits.png [watermark]; [in][watermark] overlay=10:10 [out]" anim.gif
@mistercoffee66
mistercoffee66 / jquery-dosomething-ES6.js
Last active November 6, 2019 16:03
ES6 module importing jQuery plugin
//jquery-dosomething-ES6.js
//after modification
//assumes jQuery is avail as global or via NPM etc
import jQuery from 'jquery'
export default function() {
+function($) {
var $this = $(this);
var newText = $this.data('text');
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@prodrammer
prodrammer / commands.js
Last active March 16, 2020 16:47
vuedraggable / sortablejs support files for cypress.io
/// <reference types="Cypress" />
import draggable from './draggable'
// drag and drop a source element to a target selector, anchoring the drop to the given
// position of the selector. positions are the same as the cypress trigger command
Cypress.Commands.add('drop', { prevSubject: 'element' }, ($source, selector, position) => {
cy.get(selector).then($target => {
const source = $source[0]
const target = $target[0]
draggable(source, target, position)