Skip to content

Instantly share code, notes, and snippets.

View tisuchi's full-sized avatar
🙂
Smile is Sadaqah (righteousness)

Thouhedul Islam tisuchi

🙂
Smile is Sadaqah (righteousness)
View GitHub Profile
@tisuchi
tisuchi / show-hide-button.html
Created November 11, 2017 14:57
Its for Said
<!DOCTYPE html>
<html lang="en">
<head>
<title>sayd haque video</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
@tisuchi
tisuchi / gist:cada0cf5176352c123c096452ba5f8f9
Created November 11, 2017 07:08
Said-jquery-show-hide-button.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>sayd haque video</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
<!DOCTYPE html>
<html lang="en">
<head>
<title>sayd haque video</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
@tisuchi
tisuchi / laravel-whereHas().php
Created September 20, 2017 05:55
Example of Laravel whereHas() - tisuchi.com
<?php
$users = User::whereHas('posts', function($q){
$q->where('created_at', '>=', '2015-01-01 00:00:00');
})->get();
// only users that have posts from this year are returned
?>
@tisuchi
tisuchi / laravel-has().php
Last active September 20, 2017 05:56
Example of Laravel has() - tisuchi.com
<?php
$users = User::has('posts')->get();
// only users that have at least one post are contained in the collection
@tisuchi
tisuchi / laravel-with().php
Last active September 20, 2017 05:53
Example of Laravel with() - tisuchi.com
<?php
$users = User::with('posts')->get();
foreach($users as $user){
$users->posts; // posts is already loaded and no additional DB query is run
}
?>
@tisuchi
tisuchi / Daterangepicker.js
Created September 20, 2017 05:49
Change the date format in Daterangepicker - tisuchi.com
<script type="text/javascript">
$('#calendar-field').daterangepicker(
{
locale: {
format: 'YYYY-MM-DD'
},
..... // other properties
},
@tisuchi
tisuchi / number-to-month-PHP.php
Last active September 20, 2017 05:41
Convert number to month name in PHP
<?php
// here, 1 means the first month of Year
$monthNumber = 1; //month in number
//it will return the name of the month
$getMonthName = date('F', mktime(0, 0, 0, $monthNum, 10)); // January
@tisuchi
tisuchi / gist:a62aee5188e5b1830d1e1362ab5b81c7
Created September 8, 2017 20:59
declare clean php variable 1
//its a really bad practice
$a = 'Go to school';
$b = 'Go to Market';
$c = 'Buy Items';
$d = 'Finish home task';
//good way to define variables
@tisuchi
tisuchi / laravel-fetch-results-grouped-days-way-2
Created June 30, 2017 07:13
Laravel fetch results grouped by days | Larademy.com
$users = User::where('created_at', '>=', \Carbon\Carbon::now->subMonth())
->groupBy('date')
->orderBy('date', 'DESC')
->get(array(
DB::raw('Date(created_at) as date'),
DB::raw('COUNT(*) as "views"')
));