Skip to content

Instantly share code, notes, and snippets.

View sanatem's full-sized avatar
🇦🇷
Based in Argentina

Santiago Pravisani sanatem

🇦🇷
Based in Argentina
View GitHub Profile
@sanatem
sanatem / geolocation.js
Created May 9, 2023 16:09
Geolocation React example
const [coords, setCoords] = useState({});
useEffect(() => {
navigator.geolocation.getCurrentPosition(
position => {
const { latitude, longitude } = position.coords;
setCoords({ lat: latitude, lng: longitude });
},
error => {
console.log(error.message);
@sanatem
sanatem / orders.json
Created January 4, 2022 17:59
Available orders
[
{
"unit_price": 21,
"requested_product": "h-basic",
"quantity_of_products": 3,
"quarters_to_pay": 4,
"required_product_quality_index": 0,
"market_id": 1,
"number": "2-027",
"year": 2,
@sanatem
sanatem / modal.js
Last active July 8, 2020 22:36
Dynamically fill modals ver 2.
$(".modal-btn").click(function (event) {
// Get the modal
event.preventDefault();
modal = document.getElementById(event.target.closest("button").dataset.modal);
modal.style.display = "block";
});
// When the user clicks on (x), close the modal
$(".close").click(function (event) {
modal = event.target.closest(".modal");
@sanatem
sanatem / gist:98d0ad59190cb2a1d820a605e25f1407
Created March 22, 2020 15:03
Wget - Download a website
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains example.com \
www.example.com
@sanatem
sanatem / index.js
Created November 6, 2019 13:57
Webex Meetings demo
const Webex = require('webex');
const myAccessToken = 'YOUR_ACCESS_TOKEN';
if (myAccessToken === 'YOUR_ACCESS_TOKEN') {
alert('Make sure to update your access token in the index.js file!');
return;
}
webex = Webex.init({
@sanatem
sanatem / listeners.js
Last active November 6, 2019 13:56
Webex meetings Event listeners
function bindMeetingEvents(meeting) {
meeting.on('error', (err) => {
console.error(err);
});
// Handle media streams changes to ready state
meeting.on('media:ready', (media) => {
if (!media) {
return;
}
@sanatem
sanatem / server.js
Last active November 21, 2019 21:16
Show Rooms from the Webex API
function oauthFlowCompletedShowRooms(access_token, res) {
// Retreive rooms from user: GET https://api.ciscospark.com/v1/rooms
const options = {
method: 'GET',
url: 'https://api.ciscospark.com/v1/rooms',
headers:
{
"authorization": "Bearer " + access_token
}
@sanatem
sanatem / capybara cheat sheet
Created May 20, 2019 12:12 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
### Keybase proof
I hereby claim:
* I am sanatem on github.
* I am sanatem (https://keybase.io/sanatem) on keybase.
* I have a public key ASDPvuYEkUFrJEiARnM4gqwp07WAkzvP2FqYfVl2y_3Yzwo
To claim this, I am signing this object:
### Keybase proof
I hereby claim:
* I am sanatem on github.
* I am sanatem (https://keybase.io/sanatem) on keybase.
* I have a public key ASDw9Ed37x76fDI51QyygaemJsi8jY29zPDAQZoXeXppRAo
To claim this, I am signing this object: