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:
# Allows you to write one-off middleware directly in config.ru. Good for prototyping. | |
# | |
# Example: | |
# | |
# use Rack::AdHoc do |app, env| | |
# status, headers, body = app.call(env) | |
# headers['X-Foo'] = 'bar' | |
# [status, headers, body] | |
# 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 |
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 |
# 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 |
# database 1 | |
# output single row in format compatible with INSERT VALUES | |
\copy (SELECT * FROM users WHERE email = 'me@example.com') To stdout With CSV force quote * null 'NULL' quote '''' | |
# database 2 | |
# insert values outputted from above command into another database | |
INSERT INTO users VALUES (...); |
I hereby claim:
To claim this, I am signing this object:
gem 'resque-scheduler' |
#!/bin/sh | |
# Clear the Bluetooth attributes cache on Mac OS X | |
# From http://expertsoverflow.com/questions/23549859/clearing-corebluetooth-gatt-cache-without-removing-bond | |
sudo defaults write /Library/Preferences/com.apple.Bluetooth CoreBluetoothCache -dict | |
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist | |
sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist |
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 |