Skip to content

Instantly share code, notes, and snippets.

View fatorx's full-sized avatar
💭
Learning and learning.

Fabio de Souza fatorx

💭
Learning and learning.
View GitHub Profile
@fatorx
fatorx / Vagrant-port-forward-to-host.md
Created November 18, 2019 19:48 — forked from radabass/Vagrant-port-forward-to-host.md
Vagrant port 80 443 forwarding to HOST machine OSX El Capitan

El Capitan OSX Vagrant port forwarding rules to use privileged ports 80 and 443

Due to the OSX limitations in ports below 1024, in order to use them without running as root the virtualbox headless you can do the following workaround, (remember the command ipfw is deprecated on El Capitan)

In the Vagrant file use ports over 1024, for instance change 80 and 443 to 8080 and 8043.

  # Apache
  config.vm.network "forwarded_port", guest: 80, host: 8080
@fatorx
fatorx / instructions.txt
Last active March 2, 2017 16:18
Websocket Server - test and configure
- Access this link: http://websocketstest.com/
- Check available ports.
- Configure your websocket server with available ports.
Good job. Now, it creates incredible applications.
@fatorx
fatorx / note.txt
Created February 16, 2017 13:00
Don't fill login and password in html forms
Include in html element :
<input name="pass" id="pass" placeholder="" class="form-control" type="password"
value="" autocomplete="new-password" />
@fatorx
fatorx / gist:24f35a5db18a71e6d39c163a8f840e0e
Created February 2, 2017 18:24
Instalar PHP ZMQ no Windows
Baixar a versão correta do PHP (x86 ou x64 | NTS ou TS)
A dll php_zmq.dll vai na pasta /ext e as demais na pasta raiz do PHP.
@fatorx
fatorx / gulpfile.js
Created January 2, 2017 14:59
Gulp execute script PHP
var exec = require('child_process').exec
gulp.task('update-templates', function(){
exec('php scripts/update-html.php', function (err, stdout, stderr) {
console.log(stdout)
console.log(stderr)
})
})
Para executar um script php em um hook do git, basta seguir alguns passos.
Por exemplo, para utilizar o hook pre-commit:
- Criar ou editar o arquivo pre-commit na pasta de .git/hooks
- Criar o arquivo pre-commit.php na pasta de .git/hooks
- Adicionar a seguinte linha para o arquivo:
php .git/hooks/pre-commit.php
@fatorx
fatorx / Retrofit.java
Created October 15, 2015 18:17
Retrofit (como eu uso)
RequestInterceptor requestInterceptor = new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addHeader("Content-Type", "application/json");
//request.addHeader("Authorization", tokenApp);
}
};
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(Configs.getAddressApi())
@fatorx
fatorx / gist:7fdbd71ae3824af43052
Last active October 8, 2015 15:33
Configuração Roboletric (Android)
Configuração Roboletric (http://robolectric.org)
build.gradle - (padrão)
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
@fatorx
fatorx / gist:794b0fefa79d9a8998cd
Created October 8, 2015 15:31
Configurar Unit Tests no Android Studio
Configurar Unit Tests no Android Studio
Adicionar, em dependencies no arquivo build.gralde do projeto, a lib Junit:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
}
@fatorx
fatorx / error-test.txt
Created October 6, 2015 13:41
Android - Error Public Constructor in Instrumentation TestCase
Error desc:
junit.framework.AssertionFailedError: Class fatorx.com.br.testdriven.MainActivityTest has no public constructor
TestCase(String name) or TestCase()
When creating the test class, and automatically implemented in some cases the constructor as follows below:
public MainActivityTest(Class<MainActivity> activityClass) {
super(activityClass);
}