This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: UTF-8 | |
| require 'json' | |
| require 'open-uri' | |
| # 2013-05-14, inspirerad av https://www.facebook.com/fjohansson/posts/10151388440332181 | |
| def get_messages data, offset = 0 | |
| comments = [] | |
| data.each do |comment| | |
| comments.push comment["message"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #encoding: utf-8 | |
| require 'csv' | |
| require 'geocoder' | |
| CSV.open("responses-geocoded.csv", "wb") do |csv| | |
| arr_of_arrs = CSV.read("responses.csv") | |
| output = {} | |
| arr_of_arrs.each_with_index do |row, i| | |
| next if i > 22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #encoding: utf-8 | |
| require 'csv' | |
| require 'json' | |
| arr_of_arrs = CSV.read("Survey-responses (2).csv") | |
| output = {} | |
| arr_of_arrs.each_with_index do |row, i| | |
| next if i == 0 | |
| lat = row[14].to_f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #encoding: utf-8 | |
| require 'mechanize' | |
| require 'csv' | |
| uri = 'http://www3.ivl.se/db/plsql/dvst_pm25_st$b1.querylist' | |
| uri2 = 'http://www3.ivl.se/db/plsql/dvst_pm10_st$b1.actionquery' | |
| agent = Mechanize.new | |
| page = agent.get uri | |
| page_no = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'net/http' | |
| require 'digest/md5' | |
| require 'sqlite3' | |
| require 'date' | |
| uri = URI('http://www.lysator.liu.se/~dp/myfile') | |
| md5 = '98a4dda5aebe0675d864cd10c5fae75a' | |
| # CREATE TABLE results (datetime at, boolean ok, integer bodysize, text errormessage); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @package Marketpress_Payment_Payson | |
| * @version 0.2 | |
| */ | |
| /* | |
| Plugin Name: Payson for Marketpress | |
| Plugin URI: http://dpg.se/wordpress/payson | |
| Description: Enables purchases via Payson in Marketpress. | |
| Author: David Hall |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: UTF-8 | |
| require 'mechanize' | |
| require 'builder' | |
| @agent = Mechanize.new | |
| def get_list(diary_id) | |
| page = @agent.get("http://diarium.lansstyrelsen.se/default.aspx") | |
| form = page.form('aspnetForm') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def convert_rt90_to_wgs84(geopos) | |
| # from http://mellifica.se/geodesi/gausskruger.js | |
| geopos=geopos.first | |
| x = geopos['x'].to_i | |
| y = geopos['y'].to_i | |
| axis = 6378137.0 # GRS 80. | |
| flattening = 1.0 / 298.257222101 # GRS 80. | |
| central_meridian = 15.0 + 48.0/60.0 + 22.624306/3600.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # encoding: UTF-8 | |
| require 'nokogiri' | |
| require 'open-uri' | |
| doc = Nokogiri::HTML(open('blogdump.html')) | |
| doc.xpath('//select[@name="primary_blog"]/option').each do |link| | |
| blog_url = link.content | |
| begin | |
| rss = Nokogiri::XML(open("#{blog_url}/feed/")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nokogiri' | |
| require 'httparty' | |
| def is_build_no(dir_name) | |
| (dir_name =~ /\/\d*$/) != nil | |
| end | |
| def is_build_time(dir_name) | |
| # Match paths ending with timestamps such as 2011-10-17_15-06-32 | |
| (dir_name =~ /\/\d*-\d*-\d*_\d*-\d*-\d*$/) != nil |