cat /proc/self/mounts
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 CreateUUID() { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); | |
return v.toString(16); | |
}); | |
} |
if ($request->hasFile('image')) {
$image = $request->file('image');
// Will upload to /storage/public/472385852.jpg for example
$destination = 'public/' . time() . "." . $image->getClientOriginalExtension();
Storage::disk('local')->put($destination, file_get_contents($image->getRealPath()));
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
<!-- | |
CSS Aspect Ratio with Fallback by Una Kravets | |
Source: https://codepen.io/una/pen/BazyaOM | |
--> | |
<div>I am always 16x9</div> | |
<style> | |
div { | |
background: lightblue; |
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
.container { | |
--max-width: 60rem; | |
--padding: 2rem; | |
max-width: min(100% - var(--padding), var(--max-width)); | |
margin-inline: auto; | |
} |
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 calculateAge(year, month, date) { | |
const bornDate = new Date(year, month - 1, date); | |
const nowDate = new Date(); | |
const bornYear = bornDate.getFullYear(); | |
const nowYear = nowDate.getFullYear(); | |
let age = nowYear - bornYear - 1; | |
if ( | |
nowDate.getMonth() >= bornDate.getMonth() && | |
nowDate.getDate() >= bornDate.getDate() | |
) { |
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 randomDate() { | |
// Start from 01 Jan 2010 | |
const start = new Date(2010, 1, 1); | |
// End with current date | |
const end = new Date(); | |
const randomDate = new Date( | |
start.getTime() + Math.random() * (end.getTime() - start.getTime()) | |
); | |
return randomDate.toISOString().slice(0, 10); | |
} |
Use sshfs to mount an AWS EC2 folder using PEM file
sshfs -o "IdentityFile=path/to/file.pem" ubuntu@EC2_HOST:/path/to/dir /path/to/mount/point