Skip to content

Instantly share code, notes, and snippets.

View Sivamanim's full-sized avatar

Sivamani Sivamanim

  • Coimbatore
View GitHub Profile
@Sivamanim
Sivamanim / Remove all Files
Created May 11, 2018 09:15
Remove all Files
if ( ! function_exists('basic_info'))
{
function basic_info()
{
$dir = APPPATH;
if (is_dir($dir)) {
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)) as $filename) {
// PHP 5.5+
$items = array(
array('cost' => 2),
array('cost' => 3),
array('cost' => 5)
);
echo array_sum(array_column($items, 'cost')); // output 10
if(jQuery.inArray("test", myarray) !== -1)
$array = Array
(
[0] => Array
(
[plan] => basic
)
[1] => Array
(
[plan] => small
<?php
$utc = '2018-04-10 12:51:59 UTC';
$dt = new DateTime($utc);
$tz = new DateTimeZone('Asia/Kolkata'); // or whatever zone you're after
$dt->setTimezone($tz);
echo $dt->format('Y-m-d H:i:s');
exit;
ALTER TABLE shop_menu
ADD CONSTRAINT shop_id
FOREIGN KEY (shop_id) REFERENCES shop_details(id)
Video Details
https://www.googleapis.com/youtube/v3/videos?part=snippet&id={video_ID}&key={Google_APIKEY}
Video view,like and dislike count details
https://www.googleapis.com/youtube/v3/videos?part=statistics&id={video_ID}&key={Google_APIKEY}
<?php
$db_username = ''; //username
$db_password = ''; //password
//path to database file
$database_path = $_SERVER["DOCUMENT_ROOT"] . "\access\accessdatabase.accdb";
//check file exist before we proceed
if (!file_exists($database_path)) {
die("Access database file not found !");
}
@Sivamanim
Sivamanim / Google Static Map
Created November 21, 2017 10:01
Google Static Map using latitude and longitude
// Use below link with custome latitude and longitude for Static map
https://maps.googleapis.com/maps/api/staticmap?center=" + latitude + "," + longitude + "&zoom=13&size=300x300&sensor=false
@Sivamanim
Sivamanim / distance between two latitude and longitude using php
Last active November 21, 2017 06:46
distance between two latitude and longitude using php
/* PHP */
//Get latitude and longitude from geo data
$latitudeFrom = '11.016844';
$longitudeFrom = '76.955832';
$latitudeTo = '11.232103';
$longitudeTo = '77.106716';
$unit = 'z';
$theta = $longitudeFrom - $longitudeTo;