Skip to content

Instantly share code, notes, and snippets.

View rafaelrozon's full-sized avatar

Rafael Rozon rafaelrozon

View GitHub Profile
@rafaelrozon
rafaelrozon / docker_cheatsheet.md
Last active February 13, 2019 19:33
#docker,#cli

fetch image docker pull <image>

run image and open terminal in image

docker run alpine -it /bin/sh

docker run --name static-site -e AUTHOR="Rafa" -d -P seqvence/static-site

docker run --name static-site -e AUTHOR="Rafa" -d -p 8888:80 seqvence/static-site

NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
TEXT=$(cat "$1" | sed '/^#.*/d')
if [ -n "$TEXT" ]
then
echo "$NAME"': '$(cat "$1" | sed '/^#.*/d') > "$1"
if [ -n "$DESCRIPTION" ]
then
echo "" >> "$1"
function serverRespondGet(server, api, data){
server.respondWith( "GET", api, [200, {
"Content-Type": "application/json",
"Access-Control-Allow-Headers":"Origin, X-Requested-With, Content-Type, Accept",
"Access-Control-Allow-Methods" : "POST, GET, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Origin" : "*"
}, JSON.stringify(data)]
);
}
1. homestead ssh
2. php -i
3. copy output and paste in https://xdebug.org/wizard.php
4. install Xdebug
5. Xdebug settings go in fpm/php.ini. Example:
[XDebug]
zend_extension="/usr/lib/php5/20131226/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_port=9000
xdebug.profiler_enable=1
@rafaelrozon
rafaelrozon / save_env_variable_laravel
Created January 4, 2016 18:20
set env variable using Dotenv package in Laravel 5
putenv("ENV_VARIABLE=$value_for_env_variable");
@rafaelrozon
rafaelrozon / ssh_without_password.txt
Last active December 31, 2015 08:09
ssh without password
ssh-keygen -t rsa
ssh user@host mkdir -p .ssh
cat .ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys'
ssh user@host 'chmod 700 .ssh; chmod 640 .ssh/authorized_keys'
ssh user@host
the user to authenticated needs to be owner of the authorized_keys file. Change it with
sudo chown user authorized_keys
boom, done!
function getAllData(targetUrl) {
$.ajax({
url: targetUrl,
type: 'GET',
dataType: 'json',
success: function (data) {
// process data
},
error: function () {
@rafaelrozon
rafaelrozon / pseudoClassSelector.css
Created June 18, 2015 00:41
pseudo class selector
tag:pseudoClassName { /* css rules */}
@rafaelrozon
rafaelrozon / childSelector
Created June 18, 2015 00:40
child selectors
parentTag > childTag { /* css rules */}
@rafaelrozon
rafaelrozon / descendantSelector.css
Created June 18, 2015 00:40
descendant selector
firstTag secondTag { /* css rules */ }