Skip to content

Instantly share code, notes, and snippets.

View INDIAN2020's full-sized avatar

Gogula Sivannarayana INDIAN2020

View GitHub Profile
http://css.dzone.com/articles/cool-things-learn-about
http://www.developed.be/2013/08/30/laravel-4-pivot-table-example-attach-and-detach/
http://code.tutsplus.com/tutorials/authentication-with-laravel-4--net-35593
GETTING LISTED APPROVED SCHOOLS
$categories = array();
foreach (School::whereApproved(1)->get() as $category) {
$categories[$category->id] = $category->name;
/**
* This javascript file checks for the brower/browser tab action.
* It is based on the file menstioned by Daniel Melo.
* Reference: http://stackoverflow.com/questions/1921941/close-kill-the-session-when-the-browser-or-tab-is-closed
-------------------------------------------------------------------------------------------------
http://eureka.ykyuen.info/2011/02/22/jquery-javascript-capture-the-browser-or-tab-closed-event/
-------------------------------------------------------------------------------------------------
*/
var validNavigation = false;
http://forumsarchive.laravel.io/viewtopic.php?pid=47877
http://stackoverflow.com/questions/18102537/pass-parameters-in-insert-query-stored-procedure-in-laravel-4
http://stackoverflow.com/questions/16982381/laravel-4-call-mysql-stored-procedure
<?php
class DateFormat {
const DATE_SHORT = 'Y-m-d';
const DATE_LONG = 'F j, Y';
const DATETIME_SHORT = 'Y-m-d H:i';
const DATETIME_LONG = 'F j, Y, g:i a';
array(
array('abbr'=>'BIT', 'name'=>'Baker Island Time', 'utc'=>'UTC-12'),
array('abbr'=>'NUT', 'name'=>'Niue Time', 'utc'=>'UTC-11'),
array('abbr'=>'SST', 'name'=>'Samoa Standard Time', 'utc'=>'UTC-11'),
array('abbr'=>'CKT', 'name'=>'Cook Island Time', 'utc'=>'UTC-10'),
array('abbr'=>'HAST', 'name'=>'Hawaii-Aleutian Standard Time', 'utc'=>'UTC-10'),
array('abbr'=>'HST', 'name'=>'Hawaii Standard Time', 'utc'=>'UTC-10'),
array('abbr'=>'TAHT', 'name'=>'Tahiti Time', 'utc'=>'UTC-10'),
array('abbr'=>'MART', 'name'=>'Marquesas Islands Time', 'utc'=>'UTC-09:30'),
array('abbr'=>'MIT', 'name'=>'Marquesas Islands Time', 'utc'=>'UTC-09:30'),
public function uploadImage($file, $field){
if (Input::hasFile($field)) {
$oldimage = $file->$field; // Fetch old image
File::delete(public_path()'/uploads/' . $oldimage); // The destination were you store the image.
}
$destinationPath = public_path().'/uploads/'; // The destination were you store the image.
$filename = $file->getClientOriginalName(); // Original file name
$upload_success = $file->move($destinationPath, $filename); // Now we move the file to its new home.
$storing_path = 'uploads/'.$filename; // store file name into the database.
@INDIAN2020
INDIAN2020 / gist:10465157
Last active August 29, 2015 13:59
highlight nav menu item in php
foreach($menu as $key => $item){
if ($item[1]){
echo '<li class="selected"><a href="'.$item[0].'">'.$key.'</a></li>';
}
else{
echo '<li><a href="'.$item[0].'">'.$key.'</a></li>';
}
}
http://codepen.io/curtisblackwell/pen/lHysE
@INDIAN2020
INDIAN2020 / gist:10466919
Created April 11, 2014 13:01
weather widget
http://codepen.io/st3ve/pen/IumKz
http://codepen.io/nickston/pen/gpsFK
http://codepen.io/bronsrobin/pen/yqzfB
http://codepen.io/mlms13/pen/vJcix
http://codepen.io/ubermensh/pen/bJEmv
http://codepen.io/ingermarien/pen/lGFwK
you can install phpunit globally:
composer global require phpunit/phpunit:3.7.*
<?php
$host = 'localhost'; // MYSQL database host adress
$db = ''; // MYSQL database name
$user = ''; // Mysql Datbase user
$pass = ''; // Mysql Datbase password
// Connect to the database
$link = mysql_connect($host, $user, $pass);
mysql_select_db($db);