Skip to content

Instantly share code, notes, and snippets.

View yurydelendik's full-sized avatar

Yury Delendik yurydelendik

View GitHub Profile
@thlorenz
thlorenz / steps-lldb-jit-on-osx.md
Last active April 21, 2021 09:56
lldb JIT on OSX (showing no useful info at this point)

Installation

Ninja

  • needed for faster Node.js builds
brew install ninja
@yurydelendik
yurydelendik / getpdftext.js
Last active September 22, 2017 06:40
PDF.js bookmarklet
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 December 22, 2015 00:58
Create mozilla-<beta/aurora> uplift patch for pdf.js.
#!/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 July 17, 2013 18:49
poor man droid screencast
<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 December 11, 2015 20:38
hacky pdf.js release notes gen
#! /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
@dherman
dherman / javascript.js
Created November 28, 2012 00:27
javascript
(({}+[])[!![]+!![]+!![]]+[]+(![]+[])[+!![]]+(+(!![]+!![]+!![]+[]+(+!![])))[(!![]+[])[+![]]+[]+({}+[])[+!![]]+[][(![]+[])[!![]+!![]+!![]]+[]+(![]+[])[!![]+!![]]+([][![]]+[])[!![]+!![]+!![]+!![]+!![]]+({}+[])[!![]+!![]+!![]+!![]+!![]]+(!![]+[])[!![]+!![]+!![]]][({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+(![]+[])[+!![]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]](+[![]]+[]+(!![]+[])[({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+({}+[])[+!![]]+([][![]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+![]]+(!![]+[])[+!![]]+([][![]]+[])[+![]]+({}+[])[!![]+!![]+!![]+!![]+!![]]+(!![]+[])[+![]]+({}+[])[+!![]]+(!![]+[])[+!![]]])[(![]+[])[+![]]+[]+([][![]]+[])[!![]+!![]+!![]+!![]+!![]]+(![]+[])[!![]+!![]]+(!![]+[])[+![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+!![]]]([][({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+({}+[])[+!![]]+([][![]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+![]]+(!![]+[])[+!![]]+([][![]]+[])[+![]]+({}+[])[!![]+!![]+!![]+!![]+!![]]+(!![]+[])[+![]]+({}+[])[+!![]]+(!![]+[])[+!![]]][({}+[])[!![]+!![]+!![]+!![]+!![]]+[]+({}+[])[
@brendandahl
brendandahl / gist:3373993
Created August 16, 2012 22:00
Check Messages Between Web Workers
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) {
@brendandahl
brendandahl / proxyctx.js
Created July 25, 2012 18:33
Proxy Canvas
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 19:02 — forked from brendandahl/gist:2579276
Change Channel Owner
// 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 December 24, 2011 19:41
Mozilla build environment start file with out Visual Studio check (plus git)
@echo off
SETLOCAL
SET MOZBUILDDIR=%~dp0
SET MOZILLABUILD=%MOZBUILDDIR%
echo "Mozilla tools directory: %MOZBUILDDIR%"
REM Git path
set GIT_ROOT=C:\Program Files\Git