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 / new_gist_file_0
Last active October 5, 2015 15:05
Jenkins / Java configurations
Installation
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
Configuration:
http://www.vogella.com/tutorials/Jenkins/article.html#jenkinsconfiguration
Find wich java:
@putWorkDev
putWorkDev / sh_user_apache
Last active October 6, 2015 08:48
Tooltips sh / Get user in terminal and apache
#!/bin/bash -e
#echo $(dirname $(readlink -f $0))
USER=$(whoami)
APACHE_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}')
echo $(whoami)
echo $(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}')
@putWorkDev
putWorkDev / phpsh
Last active October 3, 2016 19:35
PHP CLI
phpsh -- An interactive shell for php
http://www.phpsh.org/
@putWorkDev
putWorkDev / git-when-to-merge-vs-when-to-rebase
Last active October 31, 2016 13:03
Git tips: merge and rebase
From: https://www.derekgourlay.com/blog/git-when-to-merge-vs-when-to-rebase/
Keeping a clean history in git comes down to knowing when to use merge vs. rebase. Great quote describing when to use each:
Rebases are how changes should pass from the top of hierarchy downwards and merges are how they flow back upwards.
Rule of thumb:
- When pulling changes from origin/develop onto your local develop use rebase.
- When finishing a feature branch merge the changes back to develop.
@putWorkDev
putWorkDev / list_js_plugins
Last active October 3, 2016 23:57
Plugins js / Several Scripts
List of plugins very coool:
Xtensible RealTime Multiplatform Language allows you to:
- Discard page refreshes,
- Use Bidirectional communication,
- Write code without advanced programming skills
LINK: http://www.xrtml.org/
LINK: https://realtime.co/messaging/
Routie is a javascript hash routing library:
@putWorkDev
putWorkDev / secure_with_htaccess
Last active March 20, 2025 22:08
Security with cookies: - PREVENTING SESSION HIJACKING - PREVENTING SESSION FIXATION - Uses a secure connection (HTTPS) if possible
With .htaccess just need to add these flags:
php_value session.cookie_httponly 1
php_value session.cookie_secure 1
@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
@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 / 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 / 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