Skip to content

Instantly share code, notes, and snippets.

View adeekshith's full-sized avatar

Deekshith Allamaneni adeekshith

View GitHub Profile
@adeekshith
adeekshith / Browser based redirect
Created December 4, 2014 04:42
This PHP script detects browser and redirects to a different link for each browser. I made this for my Docs Online Viewer banner.
<?php
/*
Detects browser and redirects to a different link for each browser.
*/
$browser = $_SERVER['HTTP_USER_AGENT'];
$chrome = '/Chrome/';
$firefox = '/Firefox/';
$ie = '/MSIE/';
if (preg_match($chrome, $browser)){
//echo "chrome/opera";
@adeekshith
adeekshith / gist:6f46aef78d57ceb97f9a
Created November 6, 2014 22:34
Reverse a std::string C++
#include <algorithm>
std::reverse(str.begin(), str.end());