Skip to content

Instantly share code, notes, and snippets.

View aquelito's full-sized avatar

Axel Roche aquelito

  • Craftsman developer
  • France
View GitHub Profile
@ryanhanwu
ryanhanwu / mapViewController.m
Last active November 4, 2022 11:43
Calculate Google Map length in meters with zoom level in #Objective-C (converted from #JavaScript) #iOS #Swift
- (void)mapView:(GMSMapView*)mapView idleAtCameraPosition:(GMSCameraPosition*)position
{
CLLocationCoordinate2D topLeft = mapView.projection.visibleRegion.farLeft;
CLLocationCoordinate2D bottomLeft = mapView.projection.visibleRegion.nearLeft;
double lat = fabs(topLeft.latitude - bottomLeft.latitude);
double mpp = cos(lat * M_PI / 180) * 2 * M_PI * 6378137 / (256 * pow(2, mapView.camera.zoom));
double distance = mpp * mapView.frame.size.width;
[[SearchManager shareInstance] distance: distance];
}
@nicoptere
nicoptere / THREE.js lon_lat_to_cartesian
Last active January 16, 2023 09:56
methods to convert longitude / latitude to XYZ and back + utility polygon contains point for THREE.js
/**
* 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();
@facultymatt
facultymatt / roles_invesitgation.md
Last active April 16, 2024 09:31
Roles and permissions system for Nodejs
@dgmike
dgmike / gist:3815866
Created October 2, 2012 02:39 — forked from zuckercode/gist:3714230
redmine installer
# add database 'redmine' and user 'redmine' to mysql
aptitude -y install ruby libruby libopenssl-ruby libpgsql-ruby rubygems apache2 libapache2-mod-passenger
aptitude -y install subversion
aptitude -y install install libmysql-ruby libmysqlclient-dev
aptitude install libpq-dev libsqlite3-dev libmagick9-dev graphicsmagick-libmagick-dev-compat
cd /var/www
svn co http://redmine.rubyforge.org/svn/branches/2.0-stable redmine
cd redmine
cp config/database.yml.example config/database.yml
vim config/database.yml
@hsablonniere
hsablonniere / README.md
Created May 2, 2012 22:42
scrollIntoViewIfNeeded 4 everyone!!!

scrollIntoViewIfNeeded 4 everyone!!!

This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.

Usage

Just use the code in index.js in your app or website. You can see usage in the test page test.html.

The parent element will only scroll if the element being called is out of the view. The boolean can force the element to be centered in the scrolling area.

@ecarter
ecarter / mapOrder.js
Created December 2, 2011 15:40
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];