Skip to content

Instantly share code, notes, and snippets.

Avatar

Henrique J. P. Barcelos hjpbarcelos

View GitHub Profile
View Makefile
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 Apr 14, 2014
Composer on Windows
View cmd
> php "C:\ProgramData\ComposerSetup\bin\composer.phar" install
View query.bas
"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," & _
View bootstrap.php
<?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']
);
View gerenciar_canvas.cpp
/* 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"
View zsh
#-------------------------------------------------------------
# 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.
View getvalues.php
<?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]))) {
View AbstractResource.php
<?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 Apr 8, 2013
Pebolim com erlang.
View fussball.erl
%%% 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]),
View crypt.c
#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]);