.js
file is a module
itself, which contains important information about the file. If we console.log(module)
, it will print the following object:Module {
id: '.',
path: '/home/runner/xrfnkv6ixs',
exports: {},
parent: null,
filename: '/home/runner/xrfnkv6ixs/index.js',
loaded: false,
children: [],
paths: [
'/home/runner/xrfnkv6ixs/node_modules',
'/home/runner/node_modules',
'/home/node_modules',
'/node_modules'
],
_compile: [Function]
}
exports
key includes the content (variable / function / object) that's going to be publicly available for other modules
filename
key is equal to the module file location
...Paginator::useBootstrap();
to AppServiceProvider.php
boot
method
use Illuminate\Pagination\Paginator;
public function boot()
{
Paginator::useBootstrap();
}
{"name":"John", "age":30, "car":null,"salary": 5000,}
Query
$users = DB::table('users')
->where('column_name_in_database->salary', 5000)
->get();
border
size is included into container's width but outline
property is opposite of border, it's added outside of the containercontain
will show the entire image#img1 {
object-fit: contain;
}
cover
will take the entire space and maintain the image aspect ratio#img2 {
object-fit: cover;
}
inset
property in CSS is a shorthand for the following four properties: top
, right
, bottom
and left
.exampleText {
position: absolute;
inset: 10px 30px 60px 40px;
background-color: yellow;
}
Its parent element needs to have position
property with relative
valuediv {
background-color: green;
height: 200px;
position: relative;
color: blue;
}
.slide
document.querySelector('.slide').remove()
Removes all the elements with the specified classdocument.querySelectorAll('.slide').remove()
async function start() {
try {
fetch("https://dog.ceo/api/breeds/list/all").then(function(response) {
return response.json()
}).then(function(data) {
createBreedList(data.message)
})
} catch (e) {
console.log("There was a problem fetching the breed list.")
}
}
Fetch with async
& await
keywordsasync function start() {
try {
const response = await fetch("https://dog.ceo/api/breeds/list/all")
const data = await response.json()
createBreedList(data.message)
} catch (e) {
console.log("There was a problem fetching the breed list.")
}
}
title
element from $xml
function value_in($element_name, $xml, $content_only = true) {
if ($xml == false) {
return false;
}
$found = preg_match('#<'.$element_name.'(?:\s+[^>]+)?>(.*?)'.
'</'.$element_name.'>#s', $xml, $matches);
if ($found != false) {
if ($content_only) {
return $matches[1]; //ignore the enclosing tags
} else {
return $matches[0]; //return the full pattern match
}
}
// No match found: return false.
return false;
}
$title = value_in('title', $xml);