This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$bg = array('bg-01.jpg', 'bg-02.jpg', 'bg-03.jpg', 'bg-04.jpg', 'bg-05.jpg', 'bg-06.jpg', 'bg-07.jpg' ); // array of filenames | |
$i = rand(0, count($bg)-1); // generate random number size of the array | |
$selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Connect to database... (you'll need to create this yourself) | |
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php'; | |
// Run query... | |
$getFeed = mysql_query("SELECT * | |
FROM `rss_feed` | |
ORDER BY `time` DESC | |
")or die(mysql_error()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This module is a PHP module that enables the user to find the country, region, city, coordinates, zip code, ISP, domain name, timezone, connection speed, IDD code, area code, weather station code, weather station name, MCC, MNC, mobile brand name, elevation and usage type that any IP address or host name originates from. It has been optimized for speed and memory utilization. Developers can use the API to query all IP2Location™ binary databases for applications supporting PHP. | |
*/ | |
require_once('IP2Location.php'); | |
// Standard lookup with no cache | |
$loc = new IP2Location('databases/DB24.BIN'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "<h1>PHP Code to find the common alphabets in AMITABH BACHCHAN and RAJNIKANTH</h1>"; | |
$string1 = "AMITABH BACHCHAN"; | |
$string2 = "RAJNIKANTH"; | |
$a1 = strlen($string1); | |
$a2 = strlen($string2); | |
echo "common alphabets in AMITABH BACHCHAN AND RAJNIKANTH are :\n"; | |
for($i = 0;$i<$a1;$i++) | |
{ | |
for($j=0;$j<$a2;$j++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"url": "http://itsbalamurali.tk/", | |
"favicon": "http://g.etfv.co/http://itsbalamurali.tk", | |
"title": "Hacker's Box", | |
"description": "A Young Tech Hacker & Web2.0 Entrepreneur's blog", | |
"image": "http://31.media.tumblr.com/avatar_ab8539606fd9_48.png", | |
"thumbnail": "http://api.snapito.com/web/DOCS123/sc/http://itsbalamurali.tk" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'grape' | |
require 'favico' | |
require 'metainspector' | |
require 'link_oracle' | |
module Edison | |
class API < Grape::API | |
#Response format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Bing Images puller in action http://bingy.herokuapp.com/ | |
//this snippet will get the bing.com's current image | |
$bingimgxml = file_get_contents('http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US'); | |
$bg_img = new SimpleXMLElement($bingimgxml); | |
$image = $bg_img->image->url; | |
$img_url ="http://www.bing.com$image"; | |
header('Content-Type: image/jpeg'); | |
readfile($img_url); | |
//echo $img_url; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hub' | |
run Sinatra::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'hub' | |
run Sinatra::Application |