Skip to content

Instantly share code, notes, and snippets.

💭
loading, please wait a few seconds...

Felipe Martins felipsmartins

💭
loading, please wait a few seconds...
Block or report user

Report or block felipsmartins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@felipsmartins
felipsmartins / start_server.sh
Created May 23, 2019
PHP built-in server with env vars
View start_server.sh
# https://github.com/symfony/symfony/pull/10914
# https://www.php.net/manual/en/ini.core.php#ini.variables-order
# i.e:
APPLICATION_ENV=development php -d variables_order=EGPCS -S 0.0.0.0:8080 -t public/
@felipsmartins
felipsmartins / laravel_homestead_php56.sh
Last active May 17, 2019
laravel homestead php 56, php56, php-5.6
View laravel_homestead_php56.sh
#!/usr/bin/env bash
# script de provisionamento para laravel/homestead 7.16.*
# onde PHP 5.6 não está disponível
# atual ppa para php5.6
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php5.6
View xdebug_2_5_5_rebuild_for_php56.sh
#/bin/sh
# NOTA:
# precisei disso pra compilar a extensão contra PHP5.6, desde que o padrão no sistema (homestead) era 7.1 e pecl aponta para o 7.
# As instruções padrões estão em: https://github.com/derickr/xdebug
# mas não funciona em caso onde você quer usar o non-default PHP.
#testado contra PHP 5.6:
# phpize5.6
# php-config5.6
View mysqldump.sh
#!/usr/bin/env bash
HOST=127.0.0.1
USER=root
PASSWD=root
OUTPATH=./
# backup de base dados
DATABASES="
database1
database2
View boost.sh
# /etc/rc.local
# GPU no máximo
nvidia-settings -a GPUPowerMizerMode=1
# CPU GOV
# performance ou powersave
G_SWITCH=performance
cpufreq-set -g $G_SWITCH -c 0
View MainActivity.java
package com.example.deodorojr.compartilharsommp3;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
View collect.xml
<stringvariable variable="screen_title" value="COLETA NORMAL" />
<stringvariable variable="arquivo_coletas" value="ultima_coleta.txt" />
<stringvariable variable="arquivo_residuos" value="wastes.txt" />
<stringvariable variable="posto_user_info" value="" />
<stringvariable variable="is_valid_uc" value="1" />
<stringvariable variable="__residuos_coletados" value="" /> <!-- lista de coletas -->
<stringvariable variable="__input_uc" value="" />
<stringvariable variable="__input_codigo_residuo" value="" />
<stringvariable variable="__input_quantidade_residuo" value="" />
<stringvariable variable="__residuo_valor_unitario" value="" />
@felipsmartins
felipsmartins / Controller.php
Created Sep 25, 2018 — forked from weaverryan/Controller.php
Collecting Form Errors
View Controller.php
<?php
// put this in your controller
protected function getErrorsFromForm(FormInterface $form)
{
$errors = array();
foreach ($form->getErrors() as $error) {
$errors[] = $error->getMessage();
}
View gist:f01ff19982042f73f8f722a085ca1899
<aplicativoposxml xmlns="http://tempuri.org/posxml.xsd">
<pagina nome="principal">
<editaarquivo nomearquivo="config.dat" chave="iphost" valor="50.16.188.58" />
<editaarquivo nomearquivo="config.dat" chave="portahost" valor="8087" />
<editaarquivo nomearquivo="config.dat" chave="withssl" valor="0" />
<variavelint valor="0" variavel="iMenu"/>
<menu opcoes="1 - Download Param\2 - Download apps\3 - Menu de servicos\" variavel="$(iMenu)"/>
<if variavel="$(iMenu)" operador="igual" valor="1">
<chamafuncao nome="WalkServicesDownloadParamFile" />
@felipsmartins
felipsmartins / posxml_post_with_headers_and_httpheaders.xml
Created May 11, 2018
POSXML exmple POST raw json + http headers from terminal POS
View posxml_post_with_headers_and_httpheaders.xml
<stringvariable value="" variable="sBuffer" />
<stringvariable value="POST " variable="sVerb" />
<!-- Path -->
<stringvariable value=' /ping ' variable="sPath" />
<!-- Data to be sent -->
<stringvariable value='{"times": "3", "foo":"3698"}' variable="sPayload" />
<!-- Headers, comma separated: header1:value1,header2:value2 -->
<stringvariable value="Accept:application/json,Content-type:application/json" variable="sHeaders" />
<!-- Concatenate the strings in this order: Method (sVerb), Headers (sHeaders), Path (sPath), Payload (sPayload) -->
You can’t perform that action at this time.