Skip to content

Instantly share code, notes, and snippets.

@vasile
vasile / infofer.rb
Created October 5, 2015 20:58
data.gov.ro infofer parser
require 'nokogiri'
require 'sqlite3'
require 'FileUtils'
def seconds_to_hhmm (total_seconds)
# From http://stackoverflow.com/a/9916691
seconds = total_seconds % 60
minutes = (total_seconds / 60) % 60
hours = total_seconds / (60 * 60)
@vasile
vasile / gist:3ecb74e0689187aaffef
Created June 16, 2015 13:02
Check what WWDC sessions I didn't download
require 'nokogiri'
require 'open-uri'
downloaded_session_ids = []
Dir.glob("#{Dir.pwd}/videos/*.mp4").each do|f|
session_id_matches = f.match(/videos\/([0-9]{3})_/)
if session_id_matches.nil?
print "No session_id matches for #{f}\n"
exit
end
@vasile
vasile / tile.stamen.v1.2.1.js
Last active August 29, 2015 14:22
Hardcopy of Stamen tile maps library v1.2.1 - http://maps.stamen.com/js/tile.stamen.js?v1.2.1
(function(exports) {
/*
* tile.stamen.js v1.2.1
*/
var SUBDOMAINS = " a. b. c. d.".split(" "),
MAKE_PROVIDER = function(layer, type, minZoom, maxZoom) {
return {
"url": ["http://{S}tile.stamen.com/", layer, "/{Z}/{X}/{Y}.", type].join(""),
@vasile
vasile / gist:71de98375705a1ebb2fb
Created January 4, 2015 13:30
(Obective -) C utility for transforming latitide / longitude to swiss coordinates
float phi = (latitude * 3600 - 169028.66) / 10000;
float lambda = (longitude * 3600 - 26782.5) / 10000;
float easting = 600072.37 + 211455.93 * lambda - 10938.51 * lambda * phi - 0.36 * lambda * pow(phi, 2) - 44.54 * pow(lambda, 3);
float northing = 200147.07 + 308807.95 * phi + 3745.25 * pow(lambda, 2) + 76.63 * pow(phi, 2) - 194.56 * phi * pow(lambda, 2) + 119.79 * pow(phi, 3);
int x = (int) easting;
int y = (int) northing;
@vasile
vasile / gist:7575541
Created November 21, 2013 03:14
TPG - GeoJSON polylines used by http://maps.vasile.ch/tpg/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vasile
vasile / gist:7575511
Created November 21, 2013 03:11
TPG - GeoJSON stations Used by http://maps.vasile.ch/tpg/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vasile
vasile / gist:4964753
Created February 16, 2013 00:21
Script developed for http://geoblog.ch/?p=1539 :)
require 'open-uri'
require 'nokogiri'
require 'cgi'
require 'json'
require 'digest/sha1'
def url_resource_get(url, cache_file)
if File.file? cache_file
content = IO.read(cache_file)
else
@vasile
vasile / .tm_properties
Created December 21, 2011 21:23
Use by default soft tabs in Textmate 2
# File ~/.tm_properties
[ *.* ]
softTabs = true
@vasile
vasile / gist:1456850
Created December 10, 2011 22:48
ole EditorPanel issue
diff --git a/client/examples/editor.html b/client/examples/editor.html
index ba75604..9fd1a13 100644
--- a/client/examples/editor.html
+++ b/client/examples/editor.html
@@ -17,7 +17,7 @@
map.setCenter(new OpenLayers.LonLat(10, 50), 5);
editor = new OpenLayers.Editor(map, {
- activeControls: ['Navigation', 'SnappingSettings', 'Separator', 'DeleteFeature', 'SelectFeature', 'Separator', 'DrawHole'],
+ activeControls: ['Navigation', 'SnappingSettings', 'Separator', 'DeleteFeature', 'SelectFeature', 'Separator', 'DrawHole', 'EditorPanel'],