Skip to content

Instantly share code, notes, and snippets.

View masihyeganeh's full-sized avatar

Masih Yeganeh masihyeganeh

View GitHub Profile
@masihyeganeh
masihyeganeh / gist:3363139
Created August 15, 2012 20:02
Template of an Object Oriented node.js module
var Class = (function Class() {
var singleton_private_variable = 'Singleton Private variable';
function singleton_private_function () {
return 'Private Function';
}
var Obj = {
singleton_public_variable: 'Singleton Public variable',
@masihyeganeh
masihyeganeh / Google_PageRank_Checker.php
Created July 13, 2012 11:50
Gets Google pagerank of a website
<?php
define("GOOGLE_MAGIC", 0xE6359A60);
function zeroFill($a, $b)
{
$z = hexdec(80000000);
if ($z & $a) {
$a = ($a >> 1);
$a &= (~$z);
@masihyeganeh
masihyeganeh / SelectCourse.php
Created July 8, 2012 11:10
Functions to login to University website and select cources
<?php
function LoginAndGetCookie($server='82.99.229.141', $user, $pass)
{
$status = 'Error';
$data = 'مشکلی در انجام عملیات بوجود آمد. شاید به دلیل شلوغی سایت، این مشکل بوجود آمده. لطفاً بعداً دوباره امتحان کنید';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://' . $server . '/');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0');
@masihyeganeh
masihyeganeh / ConvertFinglishToFarsi.class.php
Created March 7, 2012 09:48
Finglish to Persian transliteration
<?php
@error_reporting(E_ALL);
@set_time_limit(0);
class ConvertFinglishToFarsi
{
/**
* Default Options
*/
public $useFarsiNumbers = false; //Replace English numbers with Persian numbers