Skip to content

Instantly share code, notes, and snippets.

@emad-elsaid
emad-elsaid / ip-scanner.php
Created February 3, 2011 00:14
IP scanner, give it range of IPs and it'll return the website title
<?php
/*
* @Script: IP Scanner
* @Version: 0.1
* @Author: Emad Elsaid
* @Email: [email protected]
* @Website: http://blazeeboy.blogspot.com
* @What is that ?:
* that is a ip acanner script
* you can give it a range of IP addresses and it'll
@emad-elsaid
emad-elsaid / msgslot.php
Created February 3, 2011 00:18
this is a straight implementation of SignalSlot pattern in PHP
<?php
/*
* @Script: Signal Slot
* @Version: 0.1
* @Author: Emad Elsaid
* @Email: [email protected]
* @Website: http://blazeeboy.blogspot.com
* @What is that ?:
* this is an implemntation of Signal/Slot pattern in PHP
* you can bind group of functions to one or more signals
<?php
$input = trim(file_get_contents('A-large-practice.in'));
$input = explode("\n",$input);
$input = array_slice($input,1);
for( $i=0; $i<count($input); $i+=3)
{
$c = intval($input[$i]);
$inputs = array_map('intval',explode(' ',$input[$i+2]));
$found = false;
<?php
$input = trim(file_get_contents('C-large-practice.in'));
$input = explode("\n",$input);
$input = array_slice($input,1);
$alter = array(
'a'=>'2',
'b'=>'22',
'c'=>'222',
'd'=>'3',
/*first: you need to add the following to the head of your file to link with Windows library.*/
using Microsoft.Win32;
/* second you'll nedd to make a new object of the folder of current user registery */
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
/* third you have to add your application key : name and path */
rkApp.SetValue("HappyV", Application.ExecutablePath.ToString());
/* that line is to remove your application from the registery */
<OBJECT ID="colosseum" WIDTH="[width]" HEIGHT="[height]"
CLASSID="CLSID:70217189-66E8-4874-9FD2-5352FDF46734">
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_ExtentX" VALUE="2646">
<PARAM NAME="_ExtentY" VALUE="1323">
<PARAM NAME="_StockProps" VALUE="0">
<PARAM NAME="server" VALUE="[serverpath]" >
<PARAM NAME="file" VALUE="[IFCfileID]" >
</OBJECT>
retrieveObjects(_T("IFCANNOTATION"), _T("Annotations"));
retrieveObjects(_T("IFCBEAM"), _T("Beams"));
retrieveObjects(_T("IFCBUILDING"), _T("Buildings"));
retrieveObjects(_T("IFCBUILDINGELEMENTPART"), _T("Building Element Parts"));
retrieveObjects(_T("IFCBUILDINGELEMENTPROXY"), _T("Building Element Proxies"));
retrieveObjects(_T("IFCBUILDINGSTOREY"), _T("Building Stories"));
retrieveObjects(_T("IFCCHAMFEREDGEFEATURE"), _T("Chamfer Edge Features"));
retrieveObjects(_T("IFCCOLUMN"), _T("Columns"));
retrieveObjects(_T("IFCCOVERING"), _T("Coverings"));
retrieveObjects(_T("IFCCURTAINWALL"), _T("Curtain Walls"));
@emad-elsaid
emad-elsaid / gist:846278
Created February 27, 2011 15:55
that correct GET and POST COOKIE and REQUEST for servers with magic quotes ON option
<?php
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
@emad-elsaid
emad-elsaid / dojo optimizer.php
Created March 12, 2011 16:19
this script i put it beside the dojo and dijit directories, i used it to remove new lines from javascript files in all the dojo project, recursively
<?php
function explore( $path ){
$files = scandir( $path );
$files = array_slice( $files, 2);
foreach( $files as $file )
if( is_dir( $path.'/'.$file ) )
explore( $path.'/'.$file );
else
process( $path.'/'.$file );
}
h2. what is content ?
content is what you see on page sometimes they call it widget or even a piece of HTML, in Codeigniter jargon it is a View files with extra features like configuration and editable areas,
simply it is a PHP file that you'll put it in some place in Egypt and it'll be dicovered as a website piece and you'll be allowed to put it anywhere
content can request data from user like text, boolean variable, file path, folder path..etc these will be available as global variables for your content, consider them as paramters and you content as a function that get executed and produce HTML to website.
h2. Where to put content files ?