Skip to content

Instantly share code, notes, and snippets.

@228vit
228vit / gist:3042f195d30083a0f44dca5cad1907e8
Created September 8, 2016 15:41
Symfony: Unit test with cookie
$client = static::createClient();
$cookie = new Cookie('name', 'value', time() + 3600 * 24 * 7, '/', null, false, false);
$client->getCookieJar()->set($cookie);
$crawler = $client->request('GET', '/', []);
@228vit
228vit / pgsql dump and restore
Last active August 29, 2015 14:15
PGSQL Dump and Restore
$ pg_dump -h localhost -U postgres -F p -f dn_name.sql db_name
$ psql -h localhost -U postgres -d db_name -f db_name.sql
@228vit
228vit / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@228vit
228vit / gist:3938347
Created October 23, 2012 11:47
Drop MYSQL index before delete any ref_id field
SET FOREIGN_KEY_CHECKS = 0; ALTER TABLE `table` DROP INDEX `index_idx` ;
@228vit
228vit / gist:3930806
Created October 22, 2012 10:24
base form doctrine
abstract class BaseFormDoctrine extends sfFormDoctrine
{
public $contentFields = array();
public function setup()
{
ProjectConfiguration::getActive()->loadHelpers( array( 'Thumbnail', 'Asset' ) );
unset($this['created_at'], $this['updated_at']);
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
###if [[ -n "$PS1" ]]; then
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace