Instantly share code, notes, and snippets.

Brandon Fish bjfish

View GitHub Profile
View main.rs
extern crate wasmer_runtime;
use std::{fs::File, io::prelude::*, str};
use wasmer_runtime::{self as runtime, prelude::*};
fn main() {
// Read the wasm file produced by our sample application...
let mut wasm_file =
File::open("./wasm-sample-app/target/wasm32-unknown-unknown/release/wasm_sample_app.wasm")
View lib.rs
// Defines functions to import from "env" namespace
extern "C" {
fn print_str(ptr: *const u8, len: usize);
}
#[no_mangle]
pub extern fn hello_wasm(){
let message = "Hello World";
unsafe {
print_str(message.as_ptr(), message.len());
View index.html
<html><head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/two.js/0.6.0/two.js"></script>
</head>
<body>
<div id="main"></div>
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Conway's Game of Life - AssemblyScript</title>
<link rel="icon" href="http://assemblyscript.org/favicon.ico" type="image/x-icon" />
<meta name="viewport" content="user-scalable=0" />
<style>
/* html, body { height: 100%; margin: 0; overflow: hidden; color: #111; background: #fff; font-family: sans-serif; } */
/* body { border-top: 2px solid #bc18d4; }
h1 { padding: 18px 20px 20px; font-size: 12pt; margin: 0; }
View gist:5418c723e27b68183dd13c4316d519fc
ActionController::RoutingError (uninitialized constant ApplicationController):
app/controllers/welcome_controller.rb:2:in `<top (required)>'
ActionController::RoutingError: uninitialized constant ApplicationController
from /Users/bfish/Documents/railstest/skip_active_record/app/controllers/welcome_controller.rb:2:in `<top (required)>'
from /Users/bfish/Documents/gem_homes/nokogiri_gem_home/gems/activesupport-4.2.9/lib/active_support/inflector/methods.rb:261:in `const_get'
from /Users/bfish/Documents/gem_homes/nokogiri_gem_home/gems/activesupport-4.2.9/lib/active_support/inflector/methods.rb:261:in `block in constantize'
View update-mri-cext.rb
# Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
# This code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1
# Run with ruby tool/update-mri-cext.rb
View console.log
$ jt environment
Environment
JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
RUBY_BIN:
GRAALVM_BIN:
GRAAL_HOME:
JVMCI_BIN:
JVMCI_GRAAL_HOME:
GRAAL_JS_JAR:
SL_JAR:
View headers.patch
Only in lib/cext/ruby: config.h
diff -ur ../ruby/include/ruby/encoding.h lib/cext/ruby/encoding.h
--- ../ruby/include/ruby/encoding.h 2017-06-28 20:38:05.000000000 -0500
+++ lib/cext/ruby/encoding.h 2017-09-03 10:51:53.000000000 -0500
@@ -44,10 +44,7 @@
#define RB_ENCODING_GET_INLINED(obj) \
(int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
-#define RB_ENCODING_GET(obj) \
- (RB_ENCODING_GET_INLINED(obj) != RUBY_ENCODING_INLINE_MAX ? \
View running_with_sulong.md
  1. Follow the steps to setup sulong from the README: https://github.com/graalvm/sulong

OSX Steps

  1. Install llvm version 3.3 I installed with the following way (mileage may vary):

    wget https://raw.githubusercontent.com/Homebrew/homebrew-versions/75e1f3f6e640b97c4f0d64d8797da94073cd612c/llvm33.rb
    brew install llvm33.rb
    
View dep_tree.md

Gem Testing

bundle install && bundle exec rake test

bundle exec rake test
\- bundle install
   \- openssl