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 / 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 / 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 / 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 / phpsh
Last active October 3, 2016 19:35
PHP CLI
phpsh -- An interactive shell for php
http://www.phpsh.org/
@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 / 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 / case-sensitive-query
Last active September 19, 2016 10:48
Tips Mysql
Make a case-sensitive query
----------
One way:
SELECT * FROM `table` WHERE BINARY like '%value%'
Other way:
SELECT * FROM `table` WHERE `column` like '%value%' COLLATE utf8_bin
@putWorkDev
putWorkDev / info.md
Last active August 29, 2015 14:21
Git Commit messages

Git Commit Messages

Use the present tense ("Add feature" not "Added feature") Use the imperative mood ("Move cursor to..." not "Moves cursor to...") Limit the first line to 72 characters or less Reference issues and pull requests liberally

Consider starting the commit message with an applicable emoji: :art: :art: when improving the format/structure of the code :racehorse: :racehorse: when improving performance

@putWorkDev
putWorkDev / svn
Created May 4, 2015 08:46
SVN Helper
Checkout svn:
svn+ssh://pathToFolder/
CheckOut Svn, para criar estrutura de um projecto de raiz:
svn co svn+ssh://pathToFolder/home/svn/repositories/ . --username nameOfUser
To use Traits, you need to be using PHP >=5.4.
More info.: http://stackoverflow.com/questions/9205083/php-traits-vs-interfaces
This is an example of how a trait works, taken straight from the docs;
<?php
class Base {
public function sayHello() {
echo 'Hello ';