Skip to content

Instantly share code, notes, and snippets.

@jarodium
jarodium / Surreal.php
Created March 19, 2023 00:45 — forked from EDDYMENS/Surreal.php
Surreal DB PHP SDK
<?php
/**
* Surreal fluent query
*
* @author EDDYMENS
* @license MIT (or other licence)
*/
class Surreal
{
@jarodium
jarodium / script.turf-sandbox
Created December 10, 2022 14:44
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
var center = [-7.9308417796178245, 37.020828075270785];
var radius = 5;
var options = {steps: 10, units: 'kilometers'};
var circle = turf.circle(center, radius, options);
var smoothed = turf.polygonSmooth(circle, {iterations: 3})
console.log(circle.geometry)
@jarodium
jarodium / script.turf-sandbox
Created December 10, 2022 14:44
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
var center = [-7.9308417796178245, 37.020828075270785];
var radius = 5;
var options = {steps: 10, units: 'kilometers'};
var circle = turf.circle(center, radius, options);
console.log(circle.geometry)
return turf.featureCollection([circle]);
@jarodium
jarodium / script.turf-sandbox
Created December 5, 2022 22:27
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
const polyRecursos = turf.polygon([[
[-7.9433882,37.0254615],[-7.9435303,37.0252195],[-7.9434177,37.0251639],[-7.9432889,37.0251296],[-7.9430636,37.0251125],[-7.9431414,37.0253202],[-7.9433882,37.0254615]
]],
{stroke: '#0FF', fill: '#0FF', 'fill-opacity': 0.3, 'stroke-width': 6}
);
const poly = turf.polygon([[
[-7.9434775157632815,37.024837920790766],
[-7.943964787435284,37.02506342920393],
@jarodium
jarodium / script.turf-sandbox
Created December 1, 2022 14:07
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
const a = turf.point(
[ -7.935581406636273, 37.01906884977351 ] ,
{'marker-symbol': 'rocket', 'marker-color': '#F00', 'marker-size': 'large'}
);
const b = turf.point(
[ -7.935580423701978, 37.0195185092705 ] ,
{'marker-symbol': 'rocket', 'marker-color': '#F0F', 'marker-size': 'large'}
@jarodium
jarodium / script.turf-sandbox
Created December 1, 2022 13:56
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
const a = turf.point(
[ -7.935754126611641, 37.015448047817706 ] ,
{'marker-symbol': 'rocket', 'marker-color': '#F00', 'marker-size': 'large'}
);
const b = turf.point(
[ -7.935753143724182, 37.01589770731469 ] ,
{'marker-symbol': 'rocket', 'marker-color': '#F0F', 'marker-size': 'large'}
@jarodium
jarodium / script.turf-sandbox
Created December 1, 2022 13:49
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
const a = turf.point(
[ -7.934943903756626, 37.01653427320952 ] ,
{'marker-symbol': 'rocket', 'marker-color': '#F00', 'marker-size': 'large'}
);
const b = turf.point(
[ -7.934943723892553, 37.01653427320952 ] ,
{'marker-symbol': 'rocket', 'marker-color': '#F0F', 'marker-size': 'large'}
@jarodium
jarodium / removehash.js
Created November 2, 2022 10:25
Remove hash
function removeHash () {
var scrollV, scrollH, loc = window.location;
if ("pushState" in history)
history.replaceState("", document.title, loc.pathname + loc.search);
else {
// Prevent scrolling by storing the page's current scroll offset
scrollV = document.body.scrollTop;
scrollH = document.body.scrollLeft;
loc.hash = "";
// Restore the scroll offset, should be flicker free
@jarodium
jarodium / history_navigation.js
Created November 2, 2022 09:35 — forked from serin113/history_navigation.js
A simple JavaScript that lets you use your browser's back/forward buttons for in-page navigation by adding custom 'next' and 'previous' events to the window object.
/*
* Lets you use your browser's back/forward buttons for in-page navigation by
* adding custom 'next' and 'previous' events to the window object.
*
* Copyright (c) 2011 Tobias Schneider <[email protected]>
* This script is freely distributable under the terms of the MIT license.
*
* Example:
*
* window.addEventListener('next', function(){
@jarodium
jarodium / sticky.js
Created April 26, 2022 16:02 — forked from javierarques/sticky.js
Sticky Sideabr With Vanilla Javascript. Detects scroll and set fixed the element. Live example: http://codepen.io/javiarques/pen/vKdgjR
// Sticky Nav Component
var Sticky = (function() {
'use strict';
var CSS_CLASS_ACTIVE = 'is-fixed';
var Sticky = {
element: null,
position: 0,
addEvents: function() {