Skip to content

Instantly share code, notes, and snippets.

View geovanisouza92's full-sized avatar
🏠
Working from home

Geo geovanisouza92

🏠
Working from home
View GitHub Profile
@geovanisouza92
geovanisouza92 / gist:1257598
Created October 2, 2011 16:24
Precedência de operadores em Ares: Não existem operadores. A precedência é dada a partir de uma cláusula nos métodos simbólicos.
method :+ (Left: Object): self take by MAXINT - 1;
begin
# do add
end
method :??? (Left: Object): self; take by 10;
begin
# do realy? method... (dummy)
end
@geovanisouza92
geovanisouza92 / gist:1354814
Created November 10, 2011 13:09
Exemplo de interação com API externa dentro do Ares...
# Exemplo de interação com API externa
var tweets := async # Execução assíncrona
from tweet in twitter.timeline # tweet = registro; twitter.timeline = array
where tweet.fromUser("one_user")
select tweet;
# Percorre o vetor de tweets
foreach tweet in tweets do # Equivalente a "foreach tweet in tweets do"... Atualizado
tweet.replyTo(tweet.from_user, "Message");
WriteLn(tweet);
end
@geovanisouza92
geovanisouza92 / validator.cpp
Created July 4, 2012 01:16
Delegates para validação automágica
#include <iostream>
#include <string>
#include <vector>
#include <typeinfo>
#include <sstream>
using namespace std;
namespace Validation
@geovanisouza92
geovanisouza92 / git-vlog
Created July 12, 2012 19:17 — forked from asabaylus/git-vlog
Git visual log for the console
# Git visual log displays commit tree view with who did what when and in which branch
git config alias.vlog 'log --graph --date-order --date=relative --pretty=format:"%C(cyan)%h: %Cblue - %an - %Cgreen %C(cyan)%ar:%Creset%n%s%n" --color'
@geovanisouza92
geovanisouza92 / pessoa.c
Created July 21, 2012 15:00
"Classe" em C
/*
* Created on: 21/07/2012
* Author: geovani
*/
#include "stdlib.h"
#include "stdio.h"
typedef struct PessoaBO Pessoa; // Definido antes para facilitar declaração
struct PessoaBO
@geovanisouza92
geovanisouza92 / chronos
Created August 19, 2012 18:10
[Git] Listando quais commits alteraram os arquivos do repositório
#! /bin/sh
CHRONOS_DIR=chronos_dir
rm -rf $CHRONOS_DIR
mkdir $CHRONOS_DIR
if [ -e $CHRONOS_DIR ]; then
for file in $(git ls-files); do
echo Chronos for $file
filename=$(basename $file)
@geovanisouza92
geovanisouza92 / Get-ArduinoFirmware.ps1
Created September 24, 2013 12:13
PowerShell script to get the most recent arduino firmware, for manual upload, with sha256 and md5 checksum's
function Get-FileHash {
param (
[string] $File = $(throw 'a filename is required'),
[string] $Algorithm = 'sha256'
)
$fileStream = [System.IO.File]::OpenRead((Resolve-Path $File))
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create($Algorithm)
@geovanisouza92
geovanisouza92 / AES.c
Created October 3, 2013 14:14 — forked from bricef/AES.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
@geovanisouza92
geovanisouza92 / gist:7160767
Created October 25, 2013 19:46
Auto assign attributes on __init__
def lazy_init(init):
import inspect
arg_names = inspect.getargspec(init)[0]
def new_init(self, *args):
for name, value in zip(arg_names[1:], args):
setattr(self, name, value)
init(self, *args)
@geovanisouza92
geovanisouza92 / RestServiceApi.java
Last active January 2, 2016 15:48
Classes que utilizei no app Android / Classes that I used in Android app: - Android Annotations 3.0; - OrmLite/Android 4.48; - Gson 2.2.4 (que reduziu pela metade o tamanho final do app, em relação ao Jackson); - Django 1.6 / Tastypie 0.11.0 (servidor); Dessa forma, consegui trazer os dados do servidor e salvar no SQLite escrevendo muito pouco (…
package ...;
import org.androidannotations.annotations.rest.Accept;
@Rest(converters = { TastypieGsonHttpMessageConverter.class })
public interface RestServiceApi {
// Optional
void setRootUrl(String rootUrl);