Skip to content

Instantly share code, notes, and snippets.

View bizmate's full-sized avatar

Diego Gullo bizmate

View GitHub Profile
@bizmate
bizmate / InitialDbMigrationCommand.php
Created September 30, 2013 13:19 — forked from bmarston/InitialDbMigrationCommand.php
Let's say you're starting a new Yii project and you've already created the database schema for it using something like phpMyAdmin or MySQL Workbench. Now you want to create an initial database migration so you can put the schema under version control, but you don't want to manually write the Yii code to create the tables, indexes, and foreign ke…
<?php
class InitialDbMigrationCommand extends CConsoleCommand
{
public function run($args) {
$schema = $args[0];
$tables = Yii::app()->db->schema->getTables($schema);
$addForeignKeys = '';
$dropForeignKeys = '';
@bizmate
bizmate / error in jenkins started vagrant ssh command
Created November 15, 2013 16:23
cannot figure out where the error is coming from
/bin/sh -xe /tmp/hudson5724027307813135954.sh
+ OE_CUSTOM_HTTP_PORT=8889
+ OE_CUSTOM_SQL_PORT=3334
+ OE_CUSTOM_IP=192.168.50.5
+ export OE_CUSTOM_HTTP_PORT
+ export OE_CUSTOM_SQL_PORT
+ export OE_CUSTOM_IP
+ vagrant destroy --force
[default] Forcing shutdown of VM...
[default] Destroying VM and associated drives...
@bizmate
bizmate / install symfony - composer
Last active August 29, 2015 13:56
Cannot install symfony despite correct php version/requirements
vagrant@precise64:/var/www$ /var/www/composer.phar create-project symfony/framework-standard-edition symfony dev-master --prefer-dist --no-interaction -vvv
Downloading https://packagist.org/packages.json
Writing /home/vagrant/.composer/cache/repo/https---packagist.org/packages.json into cache
Downloading https://packagist.org/p/provider-active$341ba3ce6e358f39ee24b4e5aa58b650251cb16e4ab90bd1fa10fc02fba62cb1.json
Writing /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-active.json into cache
Downloading https://packagist.org/p/provider-latest$2086ec2331a8f4ad6af09788a0d10dad3a09ea7df2eada2e7abb0ca2fcfa9e75.json
Writing /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-latest.json into cache
Downloading https://packagist.org/p/provider-stale$75ca0f1c535af20d88420c91c6b120e7a6f882309ff56472e5ff50fab5ad623d.json
Writing /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-stale.json into cache
Downloading http://packagist.org/p/symfony/framework-standard-edition
@bizmate
bizmate / Check Dropbox BOXES
Last active August 29, 2015 14:15
Check if vagrant boxes are available
<?php
$dpBoxes = json_decode(
'["https://dl.dropboxusercontent.com/u/29173892/vagrant-boxes/debian7.3.0-vbox4.3.6-puppet3.4.1.box",
"https://dl.dropboxusercontent.com/u/12089300/VirtualBox/openbsd53_amd64_vagrant12.box",
"https://dl.dropboxusercontent.com/u/12089300/VirtualBox/openbsd53_amd64.box",
"https://dl.dropboxusercontent.com/u/31112574/arch64-20130801.box",
"https://dl.dropboxusercontent.com/u/9213047/arch64_2013-07-28.box",
"https://dl.dropboxusercontent.com/s/kp4m59j4k5ifj9l/vagrant-archlinux64-20131221.box",
"https://dl.dropboxusercontent.com/u/6750592/Arch_Linux_2013.11_x64.box",
@bizmate
bizmate / sha512Encoding logic
Last active August 29, 2015 14:22
Symfony sha512 encoder
<?php
/*
the below is a semplification of
https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php#L44
*/
@bizmate
bizmate / HWIOAuthBundle and FOSUser Standard registration and Oauth2
Last active September 20, 2015 10:02
HWIOAuthBundle and FOSUser Standard registration and Oauth2. Be default HWIOAuthBundle overtakes FOSUser and redirects registration to the page/template where provides are shown. How do you show the registration page without exceptions as below
Trying to show standard registration form from FOSUser and connectors/provides from HWIOAuthBundle in the same page.
Getting error
Variable "form" does not exist in FOSUserBundle:Registration:register_content.html.twig at line 1
{# this is app/Resources/HWIOAuthBundle/views/Connect/login.html.twig #}
{% extends 'HWIOAuthBundle::layout.html.twig' %}
worker_processes 4;
http {
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
@bizmate
bizmate / Blackfire agent config
Last active April 20, 2020 22:16
Blackfire dockerisation
[blackfire]
; setting: log-file
; desc : Sets the path of the log file. Use stderr to log to stderr
; default: stderr
log-file=/tmp/blackfire-agent.log
;
; setting: log-level
; desc : log verbosity level (4: debug, 3: info, 2: warning, 1: error)
@bizmate
bizmate / phantomHtmlRender.js
Created June 30, 2016 00:23
phantomjs - render html does not work
"use strict";
function waitFor(testFx, onReady, timeOutMillis) {
var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 10000, //< Default Max Timout is 3s
start = new Date().getTime(),
condition = false,
interval = setInterval(function() {
if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
// If not time-out yet and condition not yet fulfilled
condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code
} else {
@bizmate
bizmate / BehatAttachFile.md
Last active September 9, 2016 10:50 — forked from nickrealdini/BehatAttachFile.md
Selenium attachFile yields empty file handle?

When I attach a file manually my file has a size value, but if I run the behat test the file size is zero.

Manual Upload:

FileList {0: File, length: 1}
	0: File
		lastModified: 1472812418000
 lastModifiedDate: Fri Sep 02 2016 11:33:38 GMT+0100 (BST)