Skip to content

Instantly share code, notes, and snippets.

@paulbarbu
paulbarbu / main.c
Last active August 29, 2015 14:17
Very simple HTTP daemon for a talk I'll be giving
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define ERR(s, f) do { perror(s); if(f) exit(1); } while(0)
const char *resp200 = "HTTP/1.1 200 OK\r\n"
"Content-Type: text/html; charset=utf-8\r\n\r\n"
"<!DOCTYPE html><html><head><meta charset=\"utf8\">"
@paulbarbu
paulbarbu / gist:923151
Created April 16, 2011 14:34
Afisarea unei structuri de date recursive
<?php
function get_directory_structure($dirpath){
$ar = array();
$dh = opendir($dirpath);
while($entry = readdir($dh)){
if($entry != "." && $entry != ".."){
if(is_dir($dirpath.DIRECTORY_SEPARATOR.$entry)) {
@paulbarbu
paulbarbu / gist:950527
Created May 1, 2011 14:14
an exercise from #yap book
<?php
/**
* void render(string $template, array $vars = NULL)
*
*/
function render($template, $vars = NULL){
if($vars != NULL){
foreach($vars as $name => $val){
$$name = $val;
}
@paulbarbu
paulbarbu / .gitignore
Created May 7, 2011 17:47
soluţiile mele pentru yap-phpro-book (paullik)
*.swp
*~
RewriteEngine on
RewriteRule guestbook/(.*)/(.*) /github/solutiile%20mele%20yap/guestbook/index.php?$1=$2
http://localhost:88/github/solutiile%20mele%20yap/guestbook/index.php?show=text
; Default configuration file for PHPDoctor
; This config file will cause PHPDoctor to generate API documentation of
; itself.
; PHPDoctor settings
; -----------------------------------------------------------------------------
; Names of files to parse. This can be a single filename, or a comma separated
[paullik@localhost peej-phpdoctor-67c1af0]$ php -f phpdoc.php yacms.ini
Reading file "/media/PauLLiK/localhost/github/yaCMS/src/global_const.php"
Parsing tokensPHP Fatal error: Call to undefined method RootDoc::packageName() in /home/paullik/Downloads/peej-phpdoctor-67c1af0/classes/phpDoctor.php on line 902
Fatal error: Call to undefined method RootDoc::packageName() in /home/paullik/Downloads/peej-phpdoctor-67c1af0/classes/phpDoctor.php on line 902
@paulbarbu
paulbarbu / yacms.ini
Created July 7, 2011 16:14
yacms.ini
; Default configuration file for PHPDoctor
; This config file will cause PHPDoctor to generate API documentation of
; itself.
; PHPDoctor settings
; -----------------------------------------------------------------------------
; Names of files to parse. This can be a single filename, or a comma separated
@paulbarbu
paulbarbu / gist:1069859
Created July 7, 2011 16:08
phpDoctor error
[paullik@localhost phpdoctor]$ php phpdoc.php yacms.ini
Reading file "/media/PauLLiK/localhost/github/yaCMS/src/functions.php"
Parsing tokensPHP Fatal error: Call to undefined method RootDoc::packageName() in /media/PauLLiK/localhost/github/phpdoctor/classes/phpDoctor.php on line 902
Fatal error: Call to undefined method RootDoc::packageName() in /media/PauLLiK/localhost/github/phpdoctor/classes/phpDoctor.php on line 902
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "./kitty_actions.c"
void main(void){
kitty jerry;
jerry = bornCat("jerry");