Skip to content

Instantly share code, notes, and snippets.

View adarwash's full-sized avatar
🍊
Working from home

adarwash

🍊
Working from home
View GitHub Profile
@adarwash
adarwash / postfix-dovecot-ubuntu14.04.sh
Created February 4, 2017 09:44 — forked from haisum/postfix-dovecot-ubuntu14.04.sh
Automated bash script to setup dovecot postfix mysql email server on ubuntu 14.04
#!/usr/bin/env bash
#####
# Script to install postfix
#####
DOMAIN="example.com"
EMAIL="haisum@example.com"
PASSWORD="example.com1*"
<?php
if (!isset($_GET['user'])) {
exit('Not a valid RSS feed. You didn\'nt provide an Instagram user. Send one via a GET variable. Example .../instarss.php?user=snoopdogg');
}
header('Content-Type: text/xml; charset=utf-8');
$html = file_get_contents('http://instagram.com/'.$_GET['user'].'/');
$html = strstr($html, '{"static_root');
// Ajax File upload with jQuery and XHR2
// Sean Clark http://square-bracket.com
// xhr2 file upload
// data is optional
$.fn.upload = function(remote,data,successFn,progressFn) {
// if we dont have post data, move it along
if(typeof data != "object") {
progressFn = successFn;
successFn = data;
}
@adarwash
adarwash / Config.php
Created November 9, 2014 11:25
Added ability to read the configuration values in the initialisation file and added comments
<?php
class Config {
//$path is the value that going to be pass thought for exmaple "Config::get('mysql/host')" the part 'mysql/host' will be the path.
public static function get($path = null){
if($path) {
//$config make it easier to write $GLOBALS['config'];
$config = $GLOBALS['config'];
// Explode will read each value in parts using the forward slash for example mysql/host mysql is first part and host is the seconned part.
$path = explode('/', $path);
// For every value in $path will be store in a variable called $bit
@adarwash
adarwash / Config.php
Created November 8, 2014 23:19
Added comments
<?php
class Config {
//$path is the value that going to be pass thought for exmaple Config::get('mysql/host') the part 'mysql/host' will be the path.
public static function get($path = null){
if($path) {
//$config make it easier to write $GLOBALS['config'];
$config = $GLOBALS['config'];
// Explode will read value my parts and the / for example mysql/host mysql is first part and mysql is the seconned part.
$path = explode('/', $path);
}
@adarwash
adarwash / init.php
Created November 8, 2014 23:11
Was unable to open sanitize.php file due to spelling mistake
<?php
//start the session
session_start();
//$GLOBALS['config'] will read the config.php class
$GLOBALS['config'] = array(
'mysql' => array(
'host' => '127.0.0.1',
'username' => 'root',
@adarwash
adarwash / init.php
Created November 8, 2014 23:09
Fix an error was unexpected "db" added comma at the end 'password' => 'Founder2013'
'password' => 'Founder2013',
@adarwash
adarwash / sanitize.php
Created November 8, 2014 22:53
Added comments
<?php
function escape($string) {
return htmlentities($string, ENT_QUOTES, 'UTF-8');
//ENT_QUOTES find any double or sigle qoutes and remove them.
// UFT-8 text format type
}