Skip to content

Instantly share code, notes, and snippets.

@sermonis
sermonis / README.md
Created August 17, 2021 14:06 — forked from superguigui/README.md
Three-orbit-controls with rotation set methods

I added a few methods to three-orbit-controls to be able to manually define phi or theta and be able to rotate to a given point.

// rotation in Y
controls.setAzimuthalAngle(theta);

// rotation in X
controls.setPolarAngle(phi);
@sermonis
sermonis / mexico.geojson
Last active August 9, 2021 17:46
GeoJSON - Estados Unidos Mexicanos
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/**
* Converts a XYZ vector3 to longitude latitude (Direct Polar)
* @param Lng longitude
* @param Lat latitude
* @param Vector3 optional output vector3
* @returns a unit vector of the 3d position
*/
function lonLatToVector3 ( lng, lat, out ) {
out = out || new THREE.Vector3();
var p1={
x:0,
y:0
};
var p2={
x:0,
y:1
};
@sermonis
sermonis / angle-between-points.js
Last active June 29, 2021 18:20 — forked from conorbuck/angle-between-points.js
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@sermonis
sermonis / GlobeControls.js
Last active July 6, 2021 15:14 — forked from dorian-moffroid-prolexia/GlobeControls.js
iTowns 2.8.0 GlobeControls.dispose() patch
// Source: https://github.com/iTowns/itowns
// Fork: https://github.com/sermonis/three-globe-map-itowns
/* globals window */
import * as THREE from 'three';
import AnimationPlayer, { Animation } from 'Core/AnimationPlayer';
import Coordinates, { ellipsoidSizes } from 'Core/Geographic/Coordinates';
import CameraUtils from 'Utils/CameraUtils';
import StateControl from 'Controls/StateControl';
@sermonis
sermonis / carfollow.js
Created June 10, 2021 14:11 — forked from photonstorm/carfollow.js
Car follow path + boost
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#2d2d2d',
parent: 'phaser-example',
scene: {
preload: preload,
create: create,
update: update
@sermonis
sermonis / README.md
Last active March 18, 2021 16:09 — forked from nerdyman/README.md
Prompt a File Download and respect the Content Disposition Header Using Fetch and FileSaver

Prompt a File Download With the Content Disposition Header Using JavaScript

Set the Server Response Headers

Expose the Content-Disposition header using the Access-Control-Expose-Headers header and set the Content-Disposition header as you would usually.

Access-Control-Expose-Headers: Content-Disposition
Content-Disposition: attachment; filename="example-file.csv"

Git

Git command reference.

Upload all files in a local directory to a new Git repository

If you have a project on your computer and you just created an empty Git repository in GitHub, use these commands to upload everything to Git.

cd your-directory
@sermonis
sermonis / index.js
Last active January 19, 2021 07:16
LIS Map scraping for Habr (https://habr.com/ru/post/302766/)
var log = require('cllc')();
var tress = require('tress');
var needle = require('needle');
var cheerio = require('cheerio');
var fs = require('fs');
var sCookie = 'http://www.puntolis.it/storelocator/defaultsearch.aspx?idcustomer=111';
var sProv = 'http://www.puntolis.it/storelocator/buildMenuProv.ashx?CodSer=111';
var sLoc = 'http://www.puntolis.it/storelocator/buildMenuLoc.ashx?CodSer=111&ProvSel=%s';
var sMarker = 'http://www.puntolis.it/storelocator/Result.aspx?provincia=%s&localita=%s&cap=XXXXX&Servizio=111';