Skip to content

Instantly share code, notes, and snippets.

@emersonmx
emersonmx / test_polymorph.c
Created June 11, 2012 04:19
um exemplo de polimorfismo em C!
#include <stdio.h>
typedef struct polymorph polymorph;
struct polymorph
{
void* data;
int (*compare) (polymorph*, void*);
};
int polymorph_compare(polymorph* p1, polymorph* p2)
@emersonmx
emersonmx / Makefile.am
Last active December 11, 2015 04:19
Arquivos de configuração para projeto usando autotools.
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src
@emersonmx
emersonmx / autobuild.sh
Last active December 11, 2015 20:19
Script para gerar um arquivo dvi a partir de uma arquivo .tex
#! /bin/bash
# Se houver mais de 1 arquivos .tex no diretório de execução, o latexmk não vai
# saber o que fazer. Se for seu caso, você deve especificar o arquivo a ser
# construido.
latexmk -pvc -view=none # arquivo.tex
@emersonmx
emersonmx / Makefile
Last active December 16, 2015 12:49
Makefile para projetos Javascript
JSCOMPRESS=jsmin
CONCAT=cat
PROJECT_NAME=jsproject
SOURCES=script1.js script2.js script3.js, scriptN.js
all: $(SOURCES)
$(CONCAT) $^ > $(PROJECT_NAME).js
$(JSCOMPRESS) < $(PROJECT_NAME).js > $(PROJECT_NAME)-min.js
@emersonmx
emersonmx / Gruntfile.js
Last active August 29, 2015 14:19
Script para automatizar a criação de javascript e css
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
concat: {
dist: {
src: [
"js/*.js"
],
dest: "../static/js/blog.js"
@emersonmx
emersonmx / jsoncpptest.cpp
Created August 5, 2015 16:36
Leitor de JSON usando JSONCPP :D
#include <iostream>
#include <fstream>
#include "json/json.h"
using namespace std;
void print_version(const Json::Value& root) {
cout << root["version"].asString() << endl;
}
<?php
xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);
// The POG goes here
$xhprof_data = xhprof_disable();
$XHPROF_ROOT = "./xhprof";
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
@emersonmx
emersonmx / sfml_hello.cpp
Last active January 9, 2016 21:58
A Simple Hello World with SFML.
/**
* A Simple Hello World with SFML.
*
* Build: g++ -o sfml_hello sfml_hello.cpp -lsfml-graphics -lsfml-window -lsfml-system
*/
#include <SFML/Window.hpp>
int main() {
sf::Window window(sf::VideoMode(640, 480), "Hello world!");
@emersonmx
emersonmx / simple_opengl_sfml.cpp
Created February 4, 2016 02:21
Simple OpenGL with SFML
/**
* Simple OpenGL with SFML.
*
* Build: g++ -o simple_opengl_sfml simple_opengl_sfml.cpp -lsfml-window -lsfml-system -lGL
*/
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#define WINDOW_WIDTH 640
@emersonmx
emersonmx / SFMLDebugDraw.cpp
Last active May 8, 2016 17:39
SFMLDebugDraw
#include "MXG/SFMLDebugDraw.hpp"
#include <cmath>
namespace mxg {
SFMLDebugDraw::SFMLDebugDraw(sf::RenderWindow &window, float scale)
: window_(&window), scale_(scale) {
sf::Transform transform;