Skip to content

Instantly share code, notes, and snippets.

@htakeuchi
Last active December 20, 2015 00:29
Show Gist options
  • Save htakeuchi/6042473 to your computer and use it in GitHub Desktop.
Save htakeuchi/6042473 to your computer and use it in GitHub Desktop.
RubyMotionでネットワークに置いたJSONを入力パラメタに使用 (webrick.rbはhttps://gist.github.com/Watson1978/4573005より) BubbleWrapが必要
{
"brightness": 0.07,
"saturation": 1.1,
"sharpness": 0.1
}
BW::HTTP.get("http://localhost:8080/param.json") do |res|
param = BW::JSON.parse(res.body.to_str)
filter.brightness(param["brightness"])
filter.saturation(param["saturation"])
filter.sharpness(param["sharpness"])
end
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require "webrick"
DOC_ROOT = "."
SERVER_PORT = 8080
s = WEBrick::HTTPServer.new(
:Port => SERVER_PORT,
:DocumentRoot => File.join(Dir::pwd, DOC_ROOT)
)
trap("INT") { s.shutdown }
s.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment