Skip to content

Instantly share code, notes, and snippets.

View talha08's full-sized avatar
πŸ‘¨β€πŸ’»
Easy Life, Busy Day

Md Abu Talha talha08

πŸ‘¨β€πŸ’»
Easy Life, Busy Day
View GitHub Profile
echo "Welcome to Easy Ubuntu Dev Setup 1.0"
echo -e "Maintained By SUST CSE Developer Network (SCDN)\n"
echo "Steap:1 [System Update]"
echo "Update Starts....."
sudo apt-get update
echo -e "System Update Completed Successfully\n"
echo "Step:2 [Install Apache2]"
sudo apt-get install apache2
<button type="button" class="btn btn-primary btn-lg outline">Outline</button>
/***********************
OUTLINE BUTTONS
************************/
.btn.outline {
background: none;
padding: 6px 12px;
}
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
fatal: The remote end hung up unexpectedly
Solution:
service httpd restart
service network restart
@talha08
talha08 / Depandable dropdoen
Last active August 7, 2017 10:12
Depandable dropdoen
public function create()
{
$state_id = States::pluck('name','id');
$cities = ['Please select state first'];
$venue_type = VenueType::pluck('name', 'id');
return view('venue.create', compact('venue_type','state_id','cities'))->with('title', "Create New Venue ");
}
@talha08
talha08 / CSV to Database Laravel
Created June 8, 2017 18:32
CSV to Database Laravel
Route::get ( '/', function () {
if (($handle = fopen ( public_path () . '/MOCK_DATA.csv', 'r' )) !== FALSE) {
while ( ($data = fgetcsv ( $handle, 1000, ',' )) !== FALSE ) {
$csv_data = new Csvdata ();
$csv_data->id = $data [0];
$csv_data->firstname = $data [1];
$csv_data->lastname = $data [2];
$csv_data->email = $data [3];
$csv_data->gender = $data [4];
dpkg --purge phpmyadmin
dpkg --purge mysql-server
dpkg --purge apache2.2-common
or
sudo apt-get remove apache2*
sudo apt-get remove phpmyadmin
sudo apt-get remove mysql-server
sudo apt-get remove php5
Simply you can do:
......................
$random_question = Question::orderBy(DB::raw('RAND()'))->take(1)->get();
If you want to use the syntax as you specified in your question, you can use scopes. In the model Question you can add the following method:
public function scopeTakeRandom($query, $size=1)
{
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
jQuery(document).ready(function() {
$(".select2").select2({
width: '100%',
theme: "classic"
});
});
https://www.sitepoint.com/community/t/need-a-simple-popup-modal-on-page-load-with-time-delay-fast-clean/36860/2
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>ColorBox demo</title>
<link rel="stylesheet" href="http://www.jacklmoore.com/colorbox/example1/colorbox.css" />