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 _eval(exp, env) | |
| if not list?(exp) | |
| if immediate_val?(exp) | |
| exp | |
| else | |
| lookup_var(exp, env) | |
| end | |
| else | |
| if special_form?(exp) | |
| eval_special_form(exp, env) |
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 _eval(exp, env) | |
| if not list?(exp) | |
| if immediate_val?(exp) | |
| exp | |
| else | |
| lookup_var(exp, env) | |
| end | |
| else | |
| if special_form?(exp) | |
| eval_special_form(exp, env) |
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 _eval(exp, env) | |
| if not list?(exp) | |
| if immediate_val?(exp) | |
| exp | |
| else | |
| lookup_var(exp, env) | |
| end | |
| else | |
| if special_form?(exp) | |
| eval_special_form(exp, env) |
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 _eval(exp) | |
| if not list?(exp) | |
| if immediate_val?(exp) | |
| exp | |
| else | |
| lookup_primitive_fun(exp) | |
| end | |
| else | |
| fun = _eval(car(exp)) | |
| args = eval_list(cdr(exp)) |
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 'simplehttpserver' | |
| server = SimpleHttpServer.new({ | |
| :server_ip => "0.0.0.0", | |
| :port => 8000, | |
| :document_root => "./", | |
| :debug => true, | |
| }) | |
| server.http do |r| |
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 bget(url, token) | |
| if token | |
| ret = Browser.get(url, header: { "Authorization" => "token #{token}"}) | |
| else | |
| ret = Browser.get(url) | |
| end | |
| JSON::parse(ret) | |
| end |
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 app_name(path) | |
| File.basename(path). | |
| sub(/\.rb$/, "") | |
| end | |
| # Initialize | |
| puts <<EOS | |
| Install script path? | |
| (e.g. foo/bar.rb) | |
| EOS |
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
| # # hit_and_blow | |
| # | |
| # ## Description | |
| # Hit & Blow Game. | |
| # Please enter 4-digit number. | |
| def main | |
| Popup.msg "Hit & Blow 🔫" | |
| game = HitAndBlow.new |
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
| DST = 1280 | |
| i = Image.pick_from_library | |
| puts "src: #{[i.w, i.h]}" | |
| if i.w > DST | |
| if i.w > i.h | |
| j = i.resize(DST, i.h) | |
| else | |
| j = i.resize(i.w, DST) |
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
| puts "--- main bundle ---" | |
| img = Image.load("sample.jpg") | |
| p img | |
| puts img | |
| puts "--- Documents root ---" | |
| img = Image.load(File.join(Dir.documents, "tango/image/tango-01.jpg")) | |
| p img | |
| puts img |