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
//insert image | |
$file = $request->image; | |
$path = '/backend/upload/'; | |
$image = $path.uniqid().time().'.'.$file->getClientOriginalExtension(); | |
$file->move(public_path().($path), $image); | |
$data['image'] = $image; | |
//update image | |
$file = $request->file('image'); | |
if ($file){ |
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
*** html | |
// form | |
<div class="input-group"> | |
<div class="input-group-prepend"> | |
<span class="input-group-text">Profile picture</span> | |
</div> | |
<div class="custom-file"> | |
<input name="image" type="hidden" id="crop_img"> | |
<input type="file" class="custom-file-input" id="upload_image"> |
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
<input onchange="document.getElementById('ins_preview_img').src = window.URL.createObjectURL(this.files[0])"> | |
<img src="" alt="" id="ins_preview_img" > |
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
//get latitude and longitude | |
if (navigator.geolocation){ | |
navigator.geolocation.getCurrentPosition(function(position) { | |
console.log(position.coords.latitude, position.coords.longitude) | |
}); | |
} |
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 acc = document.getElementsByClassName("sh-box-content"); | |
var panel = document.getElementsByClassName('sh-details'); | |
for (var i = 0; i < acc.length; i++) { | |
acc[i].onclick = function() { | |
var setClasses = !this.classList.contains('active'); | |
setClass(acc, 'active', 'remove'); | |
setClass(panel, 'show', 'remove'); | |
if (setClasses) { |
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
// way 1: | |
/** | |
* Replace all SVG images with inline SVG | |
*/ | |
jQuery('img.svg').each(function(){ | |
var $img = jQuery(this); | |
var imgID = $img.attr('id'); | |
var imgClass = $img.attr('class'); | |
var imgURL = $img.attr('src'); |
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
$('#add').click(function () { | |
var id = $(this).attr("target-id"); | |
var data = {id : id}; | |
// if type post | |
// { _token: "{{ csrf_token() }}", id: 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
<?php | |
// get mac address | |
$MAC = exec('getmac'); | |
$MAC = strtok($MAC,' '); | |
echo $MAC; | |
// get ip address | |
$IP = $_SERVER['REMOTE_ADDR']; | |
echo $IP; |
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
for clone: git clone [link] | |
for create branch: git checkout -b [branchname] | |
for change branch: git checkout [branchname] | |
for branch check: git branch | |
for pull files: git pull (must be from master branch) | |
for push: git push (from your own branch and must pull from master before push) | |
for push from new branch: git push --set-upstream origin (branch Name) [for the first time] | |
if you want all master code: git merge master [from your branch] |