Skip to content

Instantly share code, notes, and snippets.

View efwe's full-sized avatar
🏠
Working from home

frank waldheim efwe

🏠
Working from home
View GitHub Profile
@efwe
efwe / gist:e926728d74b34fcf9fb26d89b1e9a132
Created April 4, 2017 06:25
using windows git and cygwin vim from cygwin
➜ ~/Devel/EAP $git rebase -i HEAD~2 git:(kryo) [8:22:55]
1 [main] vim (13992) D:\cygwin64\bin\vim.exe: *** fatal error - cygheap base mismatch detected - 0x180300408/0x180304408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution. Rebooting is also suggested if you
are unable to find another cygwin DLL.
1 [main] vim (13992) D:\cygwin64\bin\vim.exe: *** fatal error - cygheap base mismatch detected - 0x180300408/0x180304408.
This problem is probably due to using incompatible versions of the cygwin DLL.
>>> Old files removed
>>> Removing old directories
rmdir: /usr/lib32/private: Directory not empty
/usr/lib/debug/usr/lib32/private
rmdir: /usr/lib/private: Directory not empty
root@owca:/usr/src # ls -al /usr/lib32/private/
total 2406
drwxr-xr-x 2 root wheel 9 Apr 27 2016 .
firstRouteToPoint: (hashPoint) ->
callback = (response) =>
L.geoJson(response).addTo(@map)
$.get '/map/first/route/to/' + hashPoint[0] + '/' + hashPoint[1], callback, 'json'
addRoutesToPoint: (hashPoint) ->
callback = (response) =>
L.geoJson(response, {
style: (feature) =>
return {color: @random_color()}
def routes_to
lat = params[:lat].to_f
lon = params[:lon].to_f
features = []
TrackPoint.collection.aggregate([{'$geoNear' => {near: [lon, lat], spherical: true, num: 500, maxDistance: 5/6371, distanceMultiplier: 6371, distanceField: 'dist.calculated'}}, {'$group' => {'_id' => '$route_id'}}]).each { |route_id|
route = Route.find(route_id[:_id])
gjson_line = {
:type => "Feature",
:geometry => {
:type => "LineString",
def route_to
lat = params[:lat].to_f
lon = params[:lon].to_f
first_point = TrackPoint.where({:location => {'$nearSphere' => [lat, lon]}}).limit(1).first()
route = Route.find(first_point.route_id)
gjson_line = {
:type => "Feature",
:geometry => {
:type => "LineString",
:coordinates => route.track_points.map { |p| p.location }
def coverage
points = TrackPoint.mongo_client[:coverage].find.first
respond_to do |format|
format.json { render :json => points, :content_type => 'application/json' }
format.msgpack { send_data MessagePack.pack(points), :type => 'application/msgpack', :disposition => 'inline' }
end
end
fn main() {
let x: f32 = 51.0237269662;
println!("The value of x is: {}", x);
// The value of x is: 51.023727
let y: f64 = 51.0237269662;
println!("The value of y is: {}", y);
// The value of y is: 51.0237269662
}
def hull_for(min_distance, max_distance)
client = TrackPoint.mongo_client
points = []
client.command({geoNear: 'track_points', near: [20.459423, 50.799929] , spherical: true, num: 15000, minDistance: min_distance, maxDistance: max_distance, distanceMultiplier: EARTH_RADIUS}).each { |document|
document['results'].each do |point|
points << point['obj']['location']
end
}
result = []
if points.empty?
step = 0.1 # all points within 100 meters
points = []
(1..500).each { |i| # for the next 50km
min_distance = ((i-1)*step)/EARTH_RADIUS
max_distance = (i*step)/EARTH_RADIUS
hull = hull_for min_distance, max_distance # calculate the convex hull for the points in this area
unless hull.empty?
#remap once more
hull.each { |p|
points << [p[1], p[0]] # remember points
pointClicked: (point, options, event) ->
if @marker
@map.removeLayer(@marker)
@marker = L.marker(point).addTo(@map)
clickBack = (event) ->
L.DomEvent.stopPropagation(event)
@marker.on('click', clickBack)
callback = (response) =>
if @geoJsonLayer