Skip to content

Instantly share code, notes, and snippets.

@wanabe
wanabe / index.html
Last active May 7, 2016 17:28
Three.js on Opal (wrapped)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
html {
height: 100%;
}
void main() {
gl_Position = vec4( position, 1.0 );
}
@wanabe
wanabe / index.html
Last active May 6, 2016 01:40
Three.js on Opal (with Native)
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="//cdn.opalrb.org/opal/0.9.2/opal.min.js"></script>
<script src="//cdn.opalrb.org/opal/0.9.2/opal-parser.min.js"></script>
<script src="//cdn.opalrb.org/opal/0.9.2/external/opal-browser-0.2.0.js"></script>
module Minitest
def self.run
[Minitest::Test, AcceptanceValidationTest].map { |suite| suite.run }
end
class Test
def self.run
public_instance_methods(true).grep(/^test_/).sort.each do |method_name|
begin
new.send(method_name)
@wanabe
wanabe / git-i
Created July 9, 2015 07:59
git with ssh private key
#!/bin/sh
if [ -n "$GIT_SSH" ]; then
echo ssh $GIT_SSH_OPT $* 1>&2
ssh $GIT_SSH_OPT $*
else
export GIT_SSH_OPT="-i $1"
export GIT_SSH=$0
shift
echo git "$*"
exec git $*

Syntax error is raised by "p ->() do a(1) do end end", but not by "p ->() do a 1 do end end"

As below, lambda literal with do..end block can raise syntax error.

$ ./ruby -ve 'p ->() do a(1) do end end'
ruby 2.3.0dev (2015-04-26 trunk 50395) [x86_64-darwin14]
-e:1: syntax error, unexpected keyword_do_block, expecting keyword_end
p ->() do a(1) do end end
 ^
$ cat a.rb
def calc
t = Time.now
1000000.times do yield end
Time.now - t
end
r=1/2r
f=0.5
p calc{Math.sqrt(10.0)}, calc{Math.sqrt(10)}, calc{10**f}, calc{10**r}
diff --git a/sample/shader_sample/Shader/Flash.rb b/sample/shader_sample/Shader/Flash.rb
index 4fc6bd7..f83d281 100644
--- a/sample/shader_sample/Shader/Flash.rb
+++ b/sample/shader_sample/Shader/Flash.rb
@@ -1,58 +1,42 @@
# -*- coding: Windows-31J -*-
+require 'dxrubyhlsl'
-class FlashShader < DXRuby::Shader
- hlsl = <<EOS
diff --git a/dxruby.c b/dxruby.c
index 0c4800a..d8f92a3 100644
--- a/dxruby.c
+++ b/dxruby.c
@@ -135,8 +135,6 @@ static VALUE Window_sync( VALUE );
static VALUE Window_create( VALUE );
static VALUE RenderTarget_update( VALUE );
-static void ShaderCore_release( struct DXRubyShaderCore *core );
-
source "https://rubygems.org"
gem "msgpack-rpc"