Skip to content

Instantly share code, notes, and snippets.

View faogustavo's full-sized avatar

Gustavo Fão Valvassori faogustavo

View GitHub Profile
View ItunesFeedDownloader.java
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.XMLEvent;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
@faogustavo
faogustavo / MainActivity.Java
Last active February 28, 2016 19:30
Uma forma de facilitar o uso do SearchView com a Toolbar
View MainActivity.Java
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
View ObjectToJson.json
{
"data":[
{
"type":"all_types",
"id":"ID",
"attributes":{
"mBoolean":false,
"mChar":71,
"mDouble":15.256,
"mFloat":15.255999565124512,
View procedures.sql
DROP PROCEDURE IF EXISTS `registrar_usuario` ;
DROP PROCEDURE IF EXISTS `registrar_endereco` ;
DROP PROCEDURE IF EXISTS `registrar_revenda` ;
DELIMITER $$
-- Procedure OK
CREATE PROCEDURE registrar_endereco(
IN stateName VARCHAR(64),
IN stateInitials CHAR(2),
View triggers.sql
DROP TRIGGER IF EXISTS `t_demissao`;
DELIMITER $$
CREATE TRIGGER t_demissao BEFORE UPDATE
ON user
FOR EACH ROW
BEGIN
IF NEW.state = 'I' THEN
SET NEW.resignation_date = NOW();
View database.sql
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 30-Jun-2016 às 03:39
-- Versão do servidor: 10.1.8-MariaDB
-- PHP Version: 5.6.14
SET FOREIGN_KEY_CHECKS=0;
View views.sql
CREATE OR REPLACE VIEW revendas AS
SELECT
r.name as 'Nome',
count(uhr.user_id) as 'Funcionários',
a.street as 'Rua',
a.number as 'Numero',
a.complement as 'Complemento',
d.name as 'Bairro',
c.name as 'Cidade'
FROM resale r
View SortedList.java
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class SortedList<T> extends ArrayList<T> {
public enum SortOrder {ASC, DESC}
View teste.java
class Principal {
Arquivo arquivo = new Arquivo();
public static void main(String args[]) {
new Principal().executa();
}
public void executa() {
arquivo.lerDados();
}
View Rule.java
import java.util.List;
/**
* Created by faogustavo on 20/09/2016.
*/
public class Rule implements IRule{
private Rule next;
private static final String CORINGA = "*";