Skip to content

Instantly share code, notes, and snippets.

View gbuesing's full-sized avatar

Geoff Buesing gbuesing

View GitHub Profile
Dark Sky Attribute Name JSON Path Units (US)
time dt seconds since UNIX epoch
temperature main.temp °F
apparentTemperature N/A N/A
dewPoint main.dew_point °F
humidity main.humidity %
pressure main.pressure hPa
windSpeed wind.speed mph
windGust wind.gust mph
windBearing wind.deg °
Dark Sky Attribute Name JSON Path in Open Meteo Forecast API
time $.forecast.timestamp
summary $.forecast.weather.description
icon $.forecast.weather.icon
sunriseTime $.forecast.sunrise
sunsetTime $.forecast.sunset
moonPhase $.forecast.moon_phase
precipIntensity $.forecast.rain
precipProbability $.forecast.probability_of_precipitation
precipType $.forecast.weather.icon
Map attributes from the open meteo forecast api to the format used by the Dark Sky API
The Open Meteo Forecast API and the Dark Sky API have different attribute names and structures, so mapping the attributes from one API to another requires some translation. Here's a list of Open Meteo Forecast API attributes and their corresponding Dark Sky API attributes:
Temperature
Open Meteo Forecast API: "temp"
Dark Sky API: "temperature"
Minimum temperature
Open Meteo Forecast API: "temp_min"
Dark Sky API: "temperatureMin"
Maximum temperature

Keybase proof

I hereby claim:

  • I am gbuesing on github.
  • I am gbuesing (https://keybase.io/gbuesing) on keybase.
  • I have a public key ASC44xkHYLkEbRYoSApMVLq2Bxr2c0PxWMbVVszNNqiFmwo

To claim this, I am signing this object:

@gbuesing
gbuesing / copy_row.sql
Created June 8, 2017 14:16
Copy single row from one Postgres DB into another via psql
# database 1
# output single row in format compatible with INSERT VALUES
\copy (SELECT * FROM users WHERE email = '[email protected]') To stdout With CSV force quote * null 'NULL' quote ''''
# database 2
# insert values outputted from above command into another database
INSERT INTO users VALUES (...);
@gbuesing
gbuesing / transloadit_blocking_assembly_runner.rb
Last active November 19, 2016 21:23
Transloadit blocking assembly runner
# Blocks until response received
# Designed to be run from a background job, not in request-response
# Usage:
# assembly = Transloadit::Rails::Engine.template :my_template
# response = TransloaditBlockingAssemblyRunner.run assembly
# results = response['results']
module TransloaditBlockingAssemblyRunner
class Error < StandardError; end
class TimeoutError < Error; end
class AssemblyError < Error; end
@gbuesing
gbuesing / Gemfile
Last active October 28, 2020 16:01
ActiveJob with resque-scheduler on Heroku
gem 'resque-scheduler'
@gbuesing
gbuesing / neo4j_client.rb
Last active June 28, 2016 00:29
Neo4j Data Import Example
require 'rest-client'
require 'json'
module Neo4jClient
SERVER = 'http://neo4j:neo4j@localhost:7474'
def self.cypher query, params = {}
resp = RestClient.post("#{SERVER}/db/data/cypher", {query: query, params: params}.to_json, content_type: :json, accept: :json)
JSON.parse resp
end
// delare WKScriptMessageHandler as delegate
// add to WKWebViewConfiguration init:
configuration.userContentController.addScriptMessageHandler(self, name: "log")
// MARK: WKScriptMessageHandler
func userContentController(userContentController: WKUserContentController, didReceiveScriptMessage message: WKScriptMessage) {
if (message.name == "log") {
print(message.body)
}
// declare WKUIDelegate as a delegate for ApplicationController
lazy var session: TLSession = {
let session = TLSession(webViewConfiguration: self.webViewConfiguration)
session.delegate = self
session.webView.UIDelegate = self // add this
return session
}()
// MARK: WKUIDelegate