Skip to content

Instantly share code, notes, and snippets.

Avatar

Yury Delendik yurydelendik

View GitHub Profile
@thlorenz
thlorenz / steps-lldb-jit-on-osx.md
Last active May 10, 2019
lldb JIT on OSX (showing no useful info at this point)
View steps-lldb-jit-on-osx.md

Installation

Ninja

  • needed for faster Node.js builds
brew install ninja
@yurydelendik
yurydelendik / getpdftext.js
Last active Sep 22, 2017
PDF.js bookmarklet
View getpdftext.js
var next = Promise.resolve();
var content = [];
for (var i = 1; i <= PDFView.pdfDocument.numPages; i++) {
next = next.then(function (pageNum) {
return PDFView.pdfDocument.getPage(pageNum).then(function (page) {
return page.getTextContent().then(function (tc) {
content.push((tc.items || tc).map(function (x) { return x.str; }).join(' '));
});
});
}.bind(null, i));
@brendandahl
brendandahl / uplift.sh
Last active Dec 22, 2015
Create mozilla-<beta/aurora> uplift patch for pdf.js.
View uplift.sh
#!/bin/sh
set -e
if [ "$#" -ne 4 ]; then
echo "Usage: $0 1_NAME 2_MESSAGE 3_BASELINE 4_CHERRY-PICK" >&2
echo "Example: $0 annot-ap-beta \"Bug 890259 - Use text widget annotation appearance stream if it is available.\" 4e83123 feafb39" >&2
echo "Run in your mozilla-<branch> directory." >&2
exit 1
fi
read -p "Did you 1) pop all hg patches, 2) update mozilla-<version>, 3) make sure pdf.js is clean?[y\n] " -n 1
@yurydelendik
yurydelendik / droidscreen.html
Created Jul 17, 2013
poor man droid screencast
View droidscreen.html
<canvas id="screencap" onclick="turn()"></canvas>
<script>
var angle = 0;
function turn() {
angle = (angle + 90) % 360;
}
function readImage() {
var img = new Image();
img.onload = function () {
@brendandahl
brendandahl / gist:4656584
Last active Dec 11, 2015
hacky pdf.js release notes gen
View gist:4656584
#! /usr/bin/env python
"""\
%prog [options] <last pull request number>
Helper script to generate release notes from github pull request titles.
"""
import json
import urllib2
View javascript.js
(({}+[])[!![]+!![]+!![]]+[]+(![]+[])[+!![]]+(+(!![]+!![]+!![]+[]+(+!![])))[(!![]+[])[+![]]+[]+({}+[])[+!![]]+[][(![]+[])[!![]+!![]+!![]]+[]+(![]+[])[!![]+!![]]+([][![]]+[])[!![]+!![]+!![]+!![]+!![]]+({}+[])[!![]+!![]+!![]+!![]+!![]]+(!![]+[])[!![]+!![]+!![]]][({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+(![]+[])[+!![]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]](+[![]]+[]+(!![]+[])[({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+({}+[])[+!![]]+([][![]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+![]]+(!![]+[])[+!![]]+([][![]]+[])[+![]]+({}+[])[!![]+!![]+!![]+!![]+!![]]+(!![]+[])[+![]]+({}+[])[+!![]]+(!![]+[])[+!![]]])[(![]+[])[+![]]+[]+([][![]]+[])[!![]+!![]+!![]+!![]+!![]]+(![]+[])[!![]+!![]]+(!![]+[])[+![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]]([][({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+({}+[])[+!![]]+([][![]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+![]]+(!![]+[])[+!![]]+([][![]]+[])[+![]]+({}+[])[!![]+!![]+!![]+!![]+!![]]+(!![]+[])[+![]]+({}+[])[+!![]]+(!![]+[])[+!![]]][({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+({}+[])[
@brendandahl
brendandahl / gist:3373993
Created Aug 16, 2012
Check Messages Between Web Workers
View gist:3373993
var path = [];
function check(obj) {
if (typeof obj === 'object') {
for (key in obj) {
if (!obj.hasOwnProperty)
continue;
if (!obj.hasOwnProperty(key))
continue;
var nextObj = obj[key];
if (nextObj instanceof Dict || nextObj instanceof XRef) {
View proxyctx.js
var Proxy2dContext = function() {
this.actions = [];
this.deps = {};
};
Proxy2dContext.prototype = {
callFunction: function(method, args) {
// convert args to real array
args = Array.prototype.slice.call(args);
this.actions.push([0, method, args]);
},
@yurydelendik
yurydelendik / gist:2579279
Created May 2, 2012 — forked from brendandahl/gist:2579276
Change Channel Owner
View gist:2579279
// Keep the URL the same so the browser sees it as the same.
channel.originalURI = aRequest.URI;
channel.asyncOpen(proxy, aContext);
var securityManager = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
log('got secruity manager!');
var uri = ioService.newURI('resource://pdf.js/web/viewer.html', null, null);
var principal = securityManager.getCodebasePrincipal(uri);
log('created principal!');
channel.owner = principal;
log('hey we changed the owner!');
@notmasteryet
notmasteryet / start.bat
Created Dec 24, 2011
Mozilla build environment start file with out Visual Studio check (plus git)
View start.bat
@echo off
SETLOCAL
SET MOZBUILDDIR=%~dp0
SET MOZILLABUILD=%MOZBUILDDIR%
echo "Mozilla tools directory: %MOZBUILDDIR%"
REM Git path
set GIT_ROOT=C:\Program Files\Git
You can’t perform that action at this time.