Skip to content

Instantly share code, notes, and snippets.

View yurydelendik's full-sized avatar

Yury Delendik yurydelendik

View GitHub Profile
@yurydelendik
yurydelendik / !wasmllvm.md
Last active February 23, 2024 05:08
Using WebAssembly in LLVM

NOTE: the content is out-of-date. All development is moved to the https://github.com/yurydelendik/wasmception

Using WebAssembly in LLVM

Compiling

# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
export INSTALLDIR=$WORKDIR
@yurydelendik
yurydelendik / gist:1d4f7847d157cc43dfb3
Created October 7, 2015 16:39
Parsing source maps
var base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function decodeVLQ64(s) {
var i = 0;
var result = [];
var n = 0, shift = 0;
while (i < s.length) {
var j = base64Alphabet.indexOf(s[i++]);
if (j < 0) throw new Error('Bad base64 symbol');
var more = !!(j & 0x20);
@yurydelendik
yurydelendik / elf.js
Created October 7, 2015 01:25
ELF format parser
// ELF binary format parser
// See http://refspecs.linuxbase.org/elf/elf.pdf
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['exports'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports);
} else {
factory((root.elf = {}));
@yurydelendik
yurydelendik / Binary.md
Created September 25, 2015 15:37
Initiali format specification for WebAssembly/polyfill-prototype-1

Binary Format Specification

This document describes format produced by the pack-asmjs utility.

For sake of simplicity let's define WASM file as binary data packed using this format.

Data Types

The following data types is used in a WASM file. All integer and float numbers are using

@yurydelendik
yurydelendik / gist:6b71f2d7bb2d0ab0c533
Created April 29, 2015 21:41
Exampe of ATS entry
{
"_id" : ObjectId("54f91027c85afdf74b4e52bd"),
"src" : "http://s10.histats.com/3023.swf",
"tagName" : "EMBED",
"level" : 0,
"url" : "http://www.blogcandra.com/",
"site" : "http://www.blogcandra.com/",
"height" : "80",
"body_rect" : {
"right" : 1548,
diff --git a/src/shell/shell.ts b/src/shell/shell.ts
index bcffa07..2f19212 100644
--- a/src/shell/shell.ts
+++ b/src/shell/shell.ts
@@ -657,6 +657,51 @@ module Shumway.Shell {
var parsingCounter = new Shumway.Metrics.Counter(true);
+ function parseAVM1Blocks(swfFile: SWF.SWFFile, symbol, id: string) {
+ var avm1Actions: { id: string; data: Uint8Array }[] = [];
@yurydelendik
yurydelendik / 1.diff
Created April 1, 2015 23:46
No activation queue in Shumway
diff --git a/extension/firefox/content/ShumwayStreamConverter.jsm b/extension/firefox/content/ShumwayStreamConverter.jsm
index d8fa8e8..84fbe1f 100644
--- a/extension/firefox/content/ShumwayStreamConverter.jsm
+++ b/extension/firefox/content/ShumwayStreamConverter.jsm
@@ -112,6 +112,7 @@ function isShumwayEnabledFor(startupInfo) {
}
var ActivationQueue = {
+ enabled: false,
nonActive: [],
@yurydelendik
yurydelendik / Shumway Deployment (iframes).svg
Last active August 29, 2015 14:16
Shumway Extension Sandboxes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
#container {
background-color: red;
position: relative;
width: 100%;
@yurydelendik
yurydelendik / gist:f2b846dae7cb29c86d23
Last active April 26, 2024 20:39
PDF.js get/show hightlight
function getHightlightCoords() {
var pageIndex = PDFViewerApplication.pdfViewer.currentPageNumber - 1;
var page = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
var pageRect = page.canvas.getClientRects()[0];
var selectionRects = window.getSelection().getRangeAt(0).getClientRects();
var viewport = page.viewport;
var selected = selectionRects.map(function (r) {
return viewport.convertToPdfPoint(r.left - pageRect.x, r.top - pageRect.y).concat(
viewport.convertToPdfPoint(r.right - pageRect.x, r.bottom - pageRect.y));
});