Skip to content

Instantly share code, notes, and snippets.

View dflima's full-sized avatar
📱
developing stuff

Danilo dflima

📱
developing stuff
View GitHub Profile
@dflima
dflima / client.c
Created November 5, 2012 22:37
Aula de Sockets (Paralelo) - Client
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define PORTA 8880
int e_socket, conexao;
@dflima
dflima / canvas.html
Created October 17, 2012 19:54
Drawing a line between two clicked points
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var clicks = 0;
var lastClick = [0, 0];
var canvas = document.getElementById('exemploCanvas');
canvas.addEventListener('click', draw, false);
@dflima
dflima / bubble.c
Created October 17, 2012 19:42
Bubble Sort using threads
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#define DIM 10
int a[DIM], swapped = 0;
pthread_t thread[DIM];
void v_initiate() {
@dflima
dflima / bootstrap.php
Created October 17, 2012 19:34
Simple autoload function in PHP
<?php
define('RAIZ_DA_APP', dirname(__FILE__));
define('LIB', RAIZ_DA_APP.'/lib');
function meuAutoload($classe){
$d = LIB;
include "{$d}/{$classe}.php";
}
spl_autoload_register('meuAutoload');