Skip to content

Instantly share code, notes, and snippets.

View zuzuleinen's full-sized avatar

Andrei Boar zuzuleinen

View GitHub Profile
@zuzuleinen
zuzuleinen / csv-symfony-action.php
Last active January 17, 2024 11:04
CSV Response in Symfony controller action
<?php
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class CsvController extends Controller
{
/**
* Get a CSV file from an array
@zuzuleinen
zuzuleinen / git-shortcuts.sh
Last active August 29, 2015 14:05
Git shortcuts
# Initial configuration
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
git config --global core.editor "vim"
# If you want to skip the staging area when commiting a file
git commit -a -m 'added new benchmarks'
# Remove a file from git
git rm deleteme.txt
@zuzuleinen
zuzuleinen / soapclient.php
Last active April 28, 2021 02:56
Loading WSDL from servers that don't support and TLS 1.1, TLS 1.2
<?php
//PHP Fatal error:
//SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://endpoint-url?wsdl' : failed to load external entity "..."
//Sometimes this happens when SOAP client is communicating with
//remote SSL SOAP services that only support //SSLv2, SSLv3, or TLS1.0
//(and not TLS 1.1, TLS 1.2) especially using RC4-SHA ciphers.
//The ciphers option in a new stream_context is the necessary bit to make the code work:
$opts = array(
@zuzuleinen
zuzuleinen / virtual-host-ubuntu.sh
Last active August 29, 2015 14:06
Create a virtual host on Ubuntu with Apache2
#Create a symlink between your project and /var/www:
ln -s /home/andreiboar/Projects/HelloMage/ /var/www/hellomage
#Make the site available
sudo vim /etc/apache2/sites-available/hellomage.conf
#This will create a new hellomage file in the /sites-available/ directory. In this file you should add this:
<VirtualHost *:80>
DocumentRoot "/var/www/hellomage"
ServerName hellomage.dev

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
<?php
require_once dirname(__DIR__).'/../../../../app/AppKernel.php';
/**
* Test case class helpful with Entity tests requiring the database interaction.
* For regular entity tests it's better to extend standard \PHPUnit_Framework_TestCase instead.
*/
abstract class KernelAwareTest extends \PHPUnit_Framework_TestCase
{
@zuzuleinen
zuzuleinen / runTests.sh
Last active August 29, 2015 14:06 — forked from schemar/runTests.sh
#!/bin/bash
function printHelp {
echo "Load fixtures and run tests"
echo "Usage: runTests.sh [options] [directory]"
echo ""
echo "Options:"
echo " -r|--reset resets the sqlite test database before testing"
echo " -h|--help print this help"
echo ""
@zuzuleinen
zuzuleinen / import-db.sh
Created September 19, 2014 09:51
Import database from terminal
#Import my_backup.sql file in my_database for user root on localhost.
#Useful when my_backup.sql can be too large to import it via phpmyadmin
mysql -u root -p -h localhost my_database < my_backup.sql
@zuzuleinen
zuzuleinen / remote-db.php
Last active August 29, 2015 14:06
Remote database connection via phpMyAdmin
<?php
#Edit the config.inc.php file. Usually located in /etc/phpmyadmin/config.inc.php
#Add this with your data:
$i++;
$cfg['Servers'][$i]['host'] = '';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
@zuzuleinen
zuzuleinen / install-go.sh
Last active August 29, 2015 14:07
Go Installation and Setup
# Download from https://golang.org/dl/
$ sudo tar -C /usr/local -xzf go1.3.3.linux-amd64.tar.gz
#Add the lines bellow to ~/.bashrc file (and .zshrc if you have it)
export GOROOT=/usr/local/go
export GOPATH=/home/andrei/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
#Download LiteIde
https://github.com/visualfc/liteide