Skip to content

Instantly share code, notes, and snippets.

View ybouhjira's full-sized avatar

Youssef Bouhjira ybouhjira

View GitHub Profile
@ybouhjira
ybouhjira / Latex .gitignore
Last active January 2, 2016 20:49 — forked from kogakure/.gitignore
Latex .gitignore
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
@ybouhjira
ybouhjira / month_length.h
Created January 21, 2014 19:53
month lengh function
int month_length(int year, int month)
{
return (month == 2) ? 28 + !(year % 4) : 30 + (((month * 9) >> 3) & 1);
}
int month_length(int m)
{
return (0x3bbeecc >> m + m & 3) + 28;
}
@ybouhjira
ybouhjira / Timer.js
Created January 29, 2014 03:04
node.js Timer module
var util = require('util');
var EventEmitter = require('events').EventEmitter;
// EMitter
function Timer(interval)
{
var that = this;
var _interval = interval;
this.getInterval = function(){
return _interval;
@ybouhjira
ybouhjira / xmlhttprequest.html
Created January 31, 2014 20:57
XMLHttpRequest example
<html>
<head>
<title>Learning ajax</title>
<meta charset="utf-8" />
</head>
<body>
<script>
(function main () {
var httpRequest = new XMLHttpRequest();
@ybouhjira
ybouhjira / node_call_ls.js
Created February 1, 2014 03:02
This is how you call a command from node.js
var exec = require('child_process').exec;
var options = {
cwd : '/'
};
exec('ls', options, function ls_function(error, stdout, stderr){
console.log("ls : \n" + stdout);
});
@ybouhjira
ybouhjira / temperatures
Created February 1, 2014 17:13
Fichier généré contenant les températures entre 1901 et 2099
1901 :
1 :
1 : -4,10
2 : -5,12
3 : -7,16
4 : -3,9
5 : 1,11
6 : -3,9
7 : -7,14
8 : 0,10
@ybouhjira
ybouhjira / virtual.cpp
Last active August 29, 2015 13:55
Demo of virtual methods in cpp
#include <iostream>
#include <vector>
class Parent {
public:
virtual void say() {
std::cout << "I'm the parent" << std::endl;
}
};
@ybouhjira
ybouhjira / lamp.sh
Created February 12, 2014 23:12
LAMP stack install
sudo apt-get install apache2 php5 mysql-server libapache2-mod-php5 php5-mysql phpmyadmin --yes
sudo chown $USER /var/www -R
sudo ln -s /var/www/ ~/Desktop
@ybouhjira
ybouhjira / gtk-project.pro
Last active August 29, 2015 13:56
QtCreator (.pro) file for GTK+
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.c
INCLUDEPATH += /usr/include/gtk-2.0 \
/usr/include/glib-2.0 \
/usr/lib/i386-linux-gnu/glib-2.0/include/ \