Translate

Wednesday, April 4, 2018

How to edit a commit message









what you need to do is go to your repository  and type this in your command line:



  git commit --amend



Then in your text editor you can put the new commit message.

Good Luck And Happy Hacking!!!

Tuesday, March 13, 2018

Git push force









Sometimes, it is  necessary to performed a push force in our repositories, but you need to be really careful because this action will overwrite all, so you need to know what you are doing.

This is the code:

git push -f <remote> <branch>

e.g
git push -f origin my_new_feature

Wednesday, June 21, 2017

Jquery DatePicker - How to Reset Date



Sometimes,  when you are working with jquery hiding elements or showing some elements, you might need to reset Datepicker to avoid sending a wrong date.



This code will allow you to reset the date by setting a null value in the date selector



var my_date = $('#my_birthday').datepicker();
$('#btn-clear-date').on('click', function () { my_date.datepicker('setDate', null);
});

Monday, December 26, 2016

MYSQL How to prepend a string when updating a column




In order to prepend a string when you are updating a columns is kind of easy, you only need to know the right Mysqsl function to achieve that.

Example:

For any reason, someone requested you to update the user user_login for the user ID:999  with this symbol "@" prefix to each name:

   

update users 
set user_login = concat('@', user_login)
where id = 999;


 



As you can see the function "concat" is prepending the @ to each user login.

The expected output would be


ID user_login
999 @john.doe






It is important to note that Concat allows you to add a string either at the end or at the beginning.






Tuesday, November 1, 2016

Ruby on Rails: How to upgrade bundler







To upgrade bundler, just type this command in to  the command line:
gem install bundler

To check if it was upgraded , just display the new version by typing the following command:

bundle --version

Friday, September 2, 2016

Rails - How to enable asset pipeline in development


Sometimes, for debugging purpose, it can be quite helpful to enable the Rails assets pipeline in development model.


to do this, go to config/enviroments/development.rb and add the following configuration:

config.assets.debug = false
config.assets.compile = false
config.assets.digest = true

An important thing to keep in mind is be sure  to have  config.assets.debug = true (the default setting) is disabled.

Finally, you only need to restart your server and then run:

rake assets:precompile