This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Smooth Scroll</title> | |
<style type="text/css"> | |
hr { | |
height: 100vh; | |
} | |
</style> | |
</head> |
This file contains hidden or 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
public function search(Request $request) { | |
$query = trim(strip_tags($request->query('query'))); | |
$items = DB::table('podcast_items') | |
->where('title', 'LIKE', "%$query%") | |
->orWhere('description', 'LIKE', "%$query%") | |
->get(); | |
return view('podcasts.searchresults')->with([ | |
'items' => $items, |
This file contains hidden or 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
<ul class="products"> | |
<?php | |
$args = array( | |
'post_type' => 'product', | |
'posts_per_page' => 12 | |
); | |
$loop = new WP_Query( $args ); | |
if ( $loop->have_posts() ) { | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
wc_get_template_part( 'content', 'product' ); |
This file contains hidden or 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 if ($this->session->flashdata('flash_message')): ?> | |
<script> | |
swal({ | |
title: "Done", | |
text: "<?php echo $this->session->flashdata('flash_message'); ?>", | |
timer: 1500, | |
showConfirmButton: false, | |
type: 'success' | |
}); | |
</script> |
This file contains hidden or 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 | |
$subscription_date = new \Carbon\Carbon($user->subscription_ends_at); | |
$now = \Carbon\Carbon::now(); | |
$difference = $subscription_date->diff($now)->days; | |
echo "You have " . "<strong>" . $difference . "</strong>" . " days to expire"; | |
function create(array $data) | |
{ | |
$date = strtotime("+30 day"); | |
return User::create([ |
This file contains hidden or 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
function display_authors_listing_only($wp_query) | |
{ | |
if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/edit.php') !== false) { | |
if (!current_user_can('update_core')) { | |
global $current_user; | |
$wp_query->set('author', $current_user->id); | |
} | |
} | |
} |
This file contains hidden or 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
var BrowserDetect = { | |
init: function() { | |
this.browser = this.searchString(this.dataBrowser) || "Other"; | |
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; | |
}, | |
searchString: function(data) { | |
for (var i = 0; i < data.length; i++) { | |
var dataString = data[i].string; | |
this.versionSearchString = data[i].subString; |
This file contains hidden or 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
var https = require('https'); | |
var username = 'Shibly'; | |
var options = { | |
host: 'api.github.com', | |
path: '/users/' + username + '/repos', | |
method: 'GET' | |
}; | |
var request = https.request(options, function (response) { |
This file contains hidden or 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
Mac comes with git pre-installed but not pre-configured. The color coding is missing in git terminal when you are using it in mac. Use this sipmple command to enable color coding in Mac. Happy gitting :) | |
git config --global color.ui true |
This file contains hidden or 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
Download Drush to local folder (e.g. Downloads) | |
Launch Terminal and change directory (where drush is downloaded) | |
cd ~/Desktop | |
Extract it with | |
tar -zxf drush.tar.gz | |
Create /usr/local/lib (you can choose any location you want) | |
sudo mkdir drush /usr/local/lib/ |
NewerOlder