Skip to content

Instantly share code, notes, and snippets.

View putWorkDev's full-sized avatar

Hugo Pereira putWorkDev

  • Diconium
  • Lisbon
View GitHub Profile
@putWorkDev
putWorkDev / copy_content_table.mysql
Created January 10, 2016 19:27
Copiar conteudo de uma tabela para outra
//Copiar conteudo de uma tabela para outra:
INSERT gw_analytics_raw.company_app SELECT * FROM gw_analytics.company_app
@putWorkDev
putWorkDev / timezones_load_info
Last active August 24, 2016 13:57
Time zones load information
Load timezones tables with information: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
----------
By default, (at least on Debian-based installations) no time zone data is loaded into MySQL. If you want to test if they are loaded, try executing:
SELECT CONVERT_TZ('2012-06-07 12:00:00', 'GMT', 'America/New_York');
If it returns a DATETIME (in this case 2012-06-07 08:00:00), you have time zones loaded. If it returns NULL, they aren't. When not loaded, you are limited to converting using offsets (e.g. +10:00 or -6:00).
OR
SELECT COUNT(*) FROM mysql.time_zone_name;
@putWorkDev
putWorkDev / new_gist_file_0
Last active October 3, 2016 20:39
Git configuration
Step by Step: Git configuration on Ubuntu
General Git configuration.
Configure your user name and password to be visible as the author of your commits:
git config --global user.name "Your user name"
git config --global user.email "your.email@sample.com"
Configure gedit as editor for git purposes (for example editing comments).
vi is used by default, so if you don't like it proceed with this step:
git config --global core.editor gedit
@putWorkDev
putWorkDev / xdebug_config
Last active October 10, 2016 15:50
Configure xdebug
Need to install xdebug on Ubuntu so you can test that really cool PHP web app that will wow users for a decade? The first thing you need to achieve that goal is have Ubuntu installed and the lamp stack ready to go. Next open the terminal and install xdebug by using the following command:
$ sudo apt-get install php5-xdebug
Next open the php ini file on Ubuntu so that we can ensure that xdebug is being seen by the PHP engine, again from the terminal ensure you have vim installed or you can use gedit and open php.ini file
$ sudo nano /etc/php5/apache2/php.ini
At the bottom of the file add the following make sure you test the path to the xdebug.so module as it does change. Always look through the php.ini and ensure that any reference to Zend Debugger is also commented out:
# Added for xdebug
zend_extension="/usr/lib/php5/20100525/xdebug.so"
@putWorkDev
putWorkDev / build_classes
Last active March 1, 2017 00:13
Tips symfony cli
Once the metadata files are generated, you can ask Doctrine to build related entity classes by executing the following two commands:
php app/console doctrine:generate:entities CoreUserBundle
Log in as the root user (or any other MySQL user that has the CREATE, CREATE USER and GRANT OPTION privileges):
# mysql --host=<mysql_host> --port=<port> -u <mysql_user> -p<mysql_password>
Note that if MySQL is installed on the same server, the "--host" parameter can be omitted. If the "--port" parameter is omitted, the default port for MySQL traffic will be used (port 3306).
The MySQL client should display a "mysql>" prompt.
Create a new database:
mysql> CREATE DATABASE <database> CHARACTER SET utf8;
Grant access permissions:
mysql> GRANT ALL ON <database>.* TO <user>@<ezp_host> IDENTIFIED BY '<password>';
@putWorkDev
putWorkDev / nano_tips
Created October 30, 2015 09:16
Tips using nano
The keyboard combination to display the current line number whilst you are using nano is CTRL+C.
Alternatively, to display the line & column number position you could just use the -c parameter when launching nano i.e:
nano -c [filename]
To make this permanent, nano uses a configuration in your home folder ~/.nanorc
Thus to display line numbers always when using nano...
nano ~/.nanorc
@putWorkDev
putWorkDev / git_new_branch
Last active October 3, 2016 20:47
Create new branch from another
If you want create a new branch from any of the existing branch in git, just follow the options.
First change/checkout into the branch from where you want to create a new branch.
For example if you have the following branches like:
master
dev
branch1
So if you want to create a new branch called "subbranch_of_b1" under the branch named "branch1" follow the steps:
@putWorkDev
putWorkDev / bundles
Last active August 7, 2017 16:07
Bundles to Use in Symfony or other framework
List of bundles:
Media:
https://github.com/sonata-project/SonataMediaBundle
Read and write spreadsheet files:
https://github.com/box/spout
Validation:
ValidationBundle -> https://github.com/Respect/ValidationBundle
@putWorkDev
putWorkDev / plugins_install
Last active October 23, 2015 15:11
Server Apache Installations
Install composer:
- sudo apt-get -y install curl
- curl -s http://getcomposer.org/installer | php
- sudo mv composer.phar /usr/local/bin/composer
-------------------------------------
Install xdebug / phpdbg (http://phpdbg.com):
- pecl install xdebug