Skip to content

Instantly share code, notes, and snippets.

View tejastank's full-sized avatar

Tejas Tank tejastank

View GitHub Profile

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

#!/bin/sh
# Install OpenERP 7 on Digital Ocean
# Fernando Altuzar
# Modified script from Carlos E. Fonseca Zorrilla & Mario Gielissen
# First: Create a Droplet with CentOS 32 bits
# Then:
yum -y install wget unzip
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm
// PDO Connection to MySQL
$conn = new PDO('mysql:host=localhost;dbname=yourdbname', 'username', 'password');
// PDO Connection to PostgreSQL
$conn = new PDO('pgsql:host=localhost;dbname=yourdbname', 'username', 'password');
// A quick Select Query with For Loop
foreach ($conn->query("SELECT * FROM profile") as $row)
echo $row['fullname'];
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
<?php
class ssh2 {
const SSH_COMMAND_FINISHED_FLAG = '___SSH_COMMAND_FINISHED___';
private $host = 'localhost';
private $port = 22;
private $username = 'root';
private $password = '';
private $connectionMethods = array(
<?php
/**
* Make asynchronous requests to different resources as fast as possible and process the results as they are ready.
*/
class Requests
{
public $handle;
public function __construct()
{
<?php
//Setup Items
$order_items = array();
$order_items[] = array(
"Offer" => array(
"Header" => array(
"ID" => "FC-Money",
),
),
<?php
//Setup Items
$order_items = array();
$order_items[] = array(
"Offer" => array(
"Header" => array(
"ID" => "FC-Money",
),
),
@tejastank
tejastank / MagentoClient.java
Created June 25, 2012 04:45 — forked from regisbamba/MagentoClient.java
example XML-RPC client for Magento API
import redstone.xmlrpc.XmlRpcClient;
import redstone.xmlrpc.XmlRpcException;
import redstone.xmlrpc.XmlRpcFault;
import java.net.MalformedURLException;
import java.util.HashMap;
import redstone.xmlrpc.XmlRpcArray;
import redstone.xmlrpc.XmlRpcStruct;
public class MagentoClient {
@tejastank
tejastank / gist:3835596
Created October 4, 2012 18:47 — forked from philsturgeon/gist:1529194
PyroCMS Example Module details.php
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Module_Sample extends Module {
public $version = '2.0';
public function info()
{
return array(
'name' => array(