This file contains 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
body, err := ioutil.ReadAll(r.Body) | |
if err != nil { | |
log.Printf("Error decoding json %s\n", err.Error()) | |
errorHandler(w, err.Error()) | |
return | |
} | |
var m map[string]interface{} | |
json.Unmarshal(body, &m) | |
log.Println("Mappings", m) |
This file contains 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
this.autocomplete.addListener('place_changed', () => { | |
let place = this.autocomplete.getPlace(); | |
let ac = place.address_components; | |
let lat = place.geometry.location.lat(); | |
let lon = place.geometry.location.lng(); | |
let city = ac[0]["short_name"]; | |
console.log(`The user picked ${city} with the coordinates ${lat}, ${lon}`); | |
}); |
This file contains 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
<script> | |
export default { | |
mounted() { | |
this.autocomplete = new google.maps.places.Autocomplete( | |
(this.$refs.autocomplete), | |
{types: ['geocode']} | |
); | |
} | |
} | |
</script> |
This file contains 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
<style> | |
*, *::after, *::before { | |
margin: 0; | |
padding: 0; | |
box-sizing: inherit; | |
} | |
body { | |
background-color: #dcdde1; | |
color: #2f3640; |
This file contains 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
<template> | |
<div id="app"> | |
<input ref="autocomplete" | |
placeholder="Search" | |
class="search-location" | |
onfocus="value = ''" | |
type="text" /> | |
</div> | |
</template> |
This file contains 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
import zipfile as zf | |
files = zf.ZipFile("ZippedFolder.zip", 'r') | |
files.extractall('directory to extract') | |
files.close() |
This file contains 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
pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U |
This file contains 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
.inputfile { | |
width: 0.1px; | |
height: 0.1px; | |
opacity: 0; | |
overflow: hidden; | |
position: absolute; | |
z-index: -1; | |
} |
This file contains 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 imgPreview = document.getElementById('img-preview'); | |
var fileUpload = document.getElementById('file-upload'); | |
fileUpload.addEventListener('change', function(event){ | |
url = 'https://api.cloudinary.com/v1_1/<USER_ID>/image/upload'; | |
uploadPreset = '<UPLOAD_PRESET>'; | |
file = event.target.files[0]; | |
fd = new FormData(); | |
fd.append("upload_preset", uploadPreset); | |
fd.append("file", file); |
This file contains 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
$ lsof -i tcp:3000 | |
$ kill -9 <PID> |
NewerOlder