Skip to content

Instantly share code, notes, and snippets.

View hjJunior's full-sized avatar

Helio S. Junior hjJunior

View GitHub Profile
@hjJunior
hjJunior / gist:4fe04e6af18470095265a8e39a50dbe6
Created November 18, 2016 22:46 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@hjJunior
hjJunior / two_line_item_layout.xml
Created January 2, 2017 22:59 — forked from renanferrari/two_line_item_layout.xml
Android Material Design List Item Layouts (based on http://stackoverflow.com/a/27661786/518179)
<!-- Clickable and selectableItemBackground are optional -->
<RelativeLayout
android:id="@+id/two_line_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:minHeight="72dp"
android:paddingEnd="?listPreferredItemPaddingRight"
android:paddingLeft="?listPreferredItemPaddingLeft"
@hjJunior
hjJunior / sort.c
Created November 1, 2017 18:06
Sorter: Matriz em c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define t 3
void imprimir(int vet[t][t]){
int i,j,k;
for (i = 0; i < t; i++){
for (j = 0; j < t; j++){
@hjJunior
hjJunior / mysql_backup_cron.sh
Created April 11, 2018 21:24 — forked from jabranr/mysql_backup_cron.sh
Automatic MySQL dump and backup to Git repo cron job
#!/bin/sh
#
# @author: Jabran Rafique <hello@jabran.me>
# @link: http://jabran.me/articles/automatic-database-backup-using-git-hosting/
# Set variables
FULLDATE = $(date +"%Y-%d-%m %H:%M")
NOW = $(date +"%Y-%m-%d-%H-%M")
MYSQL_DUMP = `which mysqldump`
GIT = `which git`
@hjJunior
hjJunior / arvore.c
Created May 23, 2018 00:47
Getting start to learning tree in c
typedef elemento el;
struct elemento {
int valor;
el *esquerda;
el *direito;
}
el* criaArvore();
el* insere (el* raiz, el* elemento);
void imprimir(el* raiz);
@hjJunior
hjJunior / beer.dart
Created December 10, 2018 12:41
Beer model
class Beer {
final int id;
final String name;
final String tagline;
final String description;
final String image_url;
Beer.fromJSON(Map<String, dynamic> jsonMap) :
id = jsonMap['id'],
name = jsonMap['name'],
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
http: ^0.12.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
import 'package:http/http.dart' as http;
import 'dart:convert';
import '../models/beer.dart';
Future<Stream<Beer>> getBeers() async {
final String url = 'https://api.punkapi.com/v2/beers';
final client = new http.Client();
final streamedRest = await client.send(
http.Request('get', Uri.parse(url))
@hjJunior
hjJunior / app.dart
Last active December 10, 2018 14:05
Flutter project structure - Beer List App
import 'package:flutter/material.dart';
import 'screens/home.dart';
class BeerListApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Beer List App',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primaryColor: Colors.black,
import '../repository/beer_repository.dart';
import '../models/beer.dart';
...
class _HomeState extends State<Home> {
List<Beer> _beers = <Beer>[];
@override
void initState() {