Skip to content

Instantly share code, notes, and snippets.

View felipsmartins's full-sized avatar
🇧🇷
loading, please wait a few seconds...

Martins, F. felipsmartins

🇧🇷
loading, please wait a few seconds...
View GitHub Profile
@felipsmartins
felipsmartins / Controller.php
Created September 25, 2018 19:48 — forked from weaverryan/Controller.php
Collecting Form Errors
<?php
// put this in your controller
protected function getErrorsFromForm(FormInterface $form)
{
$errors = array();
foreach ($form->getErrors() as $error) {
$errors[] = $error->getMessage();
}
<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 18:11
POSXML exmple POST raw json + http headers from terminal POS
<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) -->
var sessions = [
{
'userId': "132",
'deviceType': "ios",
'startDate': ISODate('2018-02-23'),
'endDate': ISODate('2018-02-28')
},
{
@felipsmartins
felipsmartins / readxlsx.py
Last active February 5, 2018 21:12
parse
# coding: utf-8
from __future__ import print_function
"""
Para padronização será realizado:
Requerer o tipo de medição (1 = Pré | 2 = Pós);
Coluna A é o ID do status do registro;
Coluna B padronizar data/hora como dd/mm/aaaa hh:mm;
Desconsiderar colunas L até R;
@felipsmartins
felipsmartins / excel-days-to-date-rfc-868.php
Created January 29, 2018 20:51
Excel date - days to date - time protocol rfc 868
<?php
date_default_timezone_set('UTC');
/**
* Note: Excel stores dates as sequential serial numbers so that they can be used in calculations.
* January 1, 1900 is serial number 1, and
* January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900.
* You will need to change the number format (Format Cells) in order to display a proper date.
*
*
* ex.: 14-03-2012 => 40982 dias
import sys
import os
DROP_ON_RESTORE = True
dump_dir = sys.argv[1]
databases = [
'database1',
'database2',
]
@felipsmartins
felipsmartins / fetch-apicouchdb.js
Created January 22, 2018 18:48
fetch API - CouchDB
fetch('http://<HOST>:5984/<DATABASE>/_find', {
method: 'POST',
headers: {'Content-type':'application/json'},
body: JSON.stringify({"selector": {"param": "51"}})
}).then(function (response) {
response.json().then(function (value) { console.log(value) })
});
@felipsmartins
felipsmartins / mongodb-3.2-ubuntu-xenial-install-script.sh
Created September 25, 2017 01:23
mongodb-3.2-ubuntu-xenial-install-script.sh
#!/usr/bin/env bash
MONGODB_VERSION=3.2
MONGODB_PHP_DRVIVER_VERSION=1.3.0
GPG_KEY=EA312927
if [ -f /home/vagrant/.mongo ]
then
@felipsmartins
felipsmartins / install java
Created August 15, 2017 20:46
oracle java install debianh
https://wiki.debian.org/JavaPackage
baixw o java oficial e instale o pacote acima para construir um deb file desses arquivos