Skip to content

Instantly share code, notes, and snippets.

View hjpbarcelos's full-sized avatar

Henrique J. P. Barcelos hjpbarcelos

View GitHub Profile
@hjpbarcelos
hjpbarcelos / Makefile
Created September 1, 2014 01:26
Make example
main: main.c other.o
gcc -Wall main.c other.o -o main
other.o: other.c
gcc -c other.c -o other.o
@hjpbarcelos
hjpbarcelos / cmd
Created April 14, 2014 22:17
Composer on Windows
> php "C:\ProgramData\ComposerSetup\bin\composer.phar" install
"select w.WWORK_START AS work_date," & _
" w.WWORK_FINISH AS finish_date," & _
" p.PROJ_NAME as Project," & _
" a.TASK_NAME as Task," & _
" a.WASSN_COMMENTS as Comment," & _
" w.WWORK_VALUE / 60000 as work," & _
" r.RES_NAME as Resource," & _
" r.WRES_ID as resource_id," & _
" datediff(d,w.wwork_start,w.wwork_finish)+1 AS work_days" & _
" from MSP_WEB_RESOURCES r," & _
@hjpbarcelos
hjpbarcelos / bootstrap.php
Last active December 28, 2015 12:59
DIC Example
<?php
$container['connection.default.dsn'] = 'mysql:dbname=nossoconsorcio;host=localhost;charset=utf8';
$container['connection.default.user'] = 'root';
$container['connection.default.password'] = '@1234&';
$container['storage.default'] = $container->share(function($c) {
return new PdoStorage(
$c['connection.default.dsn'],
$c['connection.default.user'],
$c['connection.default.password']
);
/* gerenciar_canvas.cpp - Generated by Visual Multi-Thread Win32 */
#include "AppObjects.h"
#include "global.h"
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <conio.h>
#include <windows.h>
#include "graphics2.h"
#-------------------------------------------------------------
# Greeting, motd etc. ...
#-------------------------------------------------------------
# Color definitions (taken from Color Bash Prompt HowTo).
# Some colors might look different of some terminals.
# For example, I see 'Bold Red' as 'orange' on my screen,
# hence the 'Green' 'BRed' 'Red' sequence I often use in my prompt.
<?php
/**
* Retorna o parâmetro POST se a chave $key existe em $_POST.
* Caso não esteja, o valor $default será retornado.
* Se nenhum valor $default for informado, retorna null.
*
* @return string|null
*/
function getPost($key, $defalt = null) {
if (isset($_POST[$key]) && !empty(isset($_POST[$key]))) {
<?php
namespace GdWrapper\Image\Resource;
use GdWrapper\Image\Resource\Exceptions\InvalidRawResourceException;
use GdWrapper\Image\Resource\Exceptions\InvalidFilePathException;
abstract class AbstractResource {
const IMAGE_QUALITY_MAX = 100;
const IMAGE_QUALITY_HIGH = 90;
const IMAGE_QUALITY_MED = 75;
@hjpbarcelos
hjpbarcelos / fussball.erl
Created April 8, 2013 00:02
Pebolim com erlang.
%%% File: fussball.erl
%%% Description: A simple game of Fussball.
-module(fussball).
%% Interface
-export([start/2, init/2, stop/1, kickoff/1]).
start(MyCountry, OtherCountry) ->
spawn(?MODULE, init, [MyCountry, OtherCountry]),
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <assert.h>
int main(int argc, char *argv[]) {
assert(argc == 3);
int i;
char key = tolower(argv[2][0]);