Skip to content

Instantly share code, notes, and snippets.

View yrezgui's full-sized avatar

Yacine Rezgui yrezgui

View GitHub Profile
@yrezgui
yrezgui / renderPDF.js
Created June 8, 2012 15:34
PhantomJS test page render
var page = require('webpage').create();
page.onLoadFinished = function (status) {
page.render("cv.pdf");
phantom.exit();
}
page.open("http://yrezgui.phpfogapp.com/cv/index.html");
@yrezgui
yrezgui / monitor.js
Created July 6, 2012 08:45
Monitoring system
var http = require("http");
http.createServer(function(request, response){
response.writeHead(200, {
"Content-Type": "text/html"
});
response.write("Hello World");
response.end();
@yrezgui
yrezgui / drive.js
Created August 12, 2012 16:27
Upload a file to Google Drive using their SDK and HTML5
var bb, reader;
var meta = {
"title": "mozilla.png",
"mimeType": "image/png",
"description": "Mozilla Official logo"
};
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://developer.mozilla.org/media/img/mdn-logo-sm.png', true);
@yrezgui
yrezgui / sha1.js
Created October 2, 2012 08:53 — forked from c4y/sha1.js
SHA1 Javascript
/**
*
* Secure Hash Algorithm (SHA1)
* http://www.webtoolkit.info/
*
**/
function SHA1 (msg) {
function rotate_left(n,s) {
@yrezgui
yrezgui / gist:3817703
Created October 2, 2012 09:17 — forked from Victa/gist:1069105
Javascript MD5
var MD5 = function (string) {
function RotateLeft(lValue, iShiftBits) {
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
}
function AddUnsigned(lX,lY) {
var lX4,lY4,lX8,lY8,lResult;
lX8 = (lX & 0x80000000);
lY8 = (lY & 0x80000000);
@yrezgui
yrezgui / recaptcha.php
Created December 11, 2012 10:49
ReCaptcha Library for CodeIgniter (but cant be used for any PHP projet). I didn't test everything
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* http://recaptcha.net/plugins/php/
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
#include "StdAfx.h"
#include "CDirectUSB.h"
#include "CTools.h"
#ifdef _DEBUG
using namespace System::Diagnostics;
#endif
#define OUTPUT_SIZE 512 // Buffer TX size
@yrezgui
yrezgui / filesize-filter.js
Created May 26, 2013 18:22
This is a custom filter to show a bytes filesize in better way.
// add the filter to your application module
angular.module('myApp', ['filters']);
/**
* Filesize Filter
* @Param length, default is 0
* @return string
*/
angular.module('filters', [])
.filter('Filesize', function () {
@yrezgui
yrezgui / client.js
Created June 22, 2013 11:05
Flouss model files
// MongoDB ORM package
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var clientSchema = Schema({
firstname: {
type: String,
required: true
},
lastname: {