Skip to content

Instantly share code, notes, and snippets.

Yury Delendik yurydelendik

Block or report user

Report or block yurydelendik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yurydelendik
yurydelendik / fakelocale.html
Created Apr 30, 2012
Fake locale translator
View fakelocale.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
var table = "ãь¢Ðε£ģНiʃқḻмпOÞȡг§ţȗṿẂӾӳƩ";
@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!');
View getLineLineIntersection.js
var epsilon = 1e-8;
function getLineLineIntersection(x1, y1, x2, y2, x3, y3, x4, y4, collinearity) {
// creating coefficients for lines in the form: a * x + b + y = c
var a1 = -(y2 - y1), b1 = (x2 - x1), c1 = (x2 - x1) * y1 - (y2 - y1) * x1;
var a2 = -(y4 - y3), b2 = (x4 - x3), c2 = (x4 - x3) * y3 - (y4 - y3) * x3;
// finding the intersection
var d = a1 * b2 - a2 * b1;
if (d == 0) {
// two lines are parallel to each other
View scale.html
<!doctype html>
<canvas id="sample" width="400" height="400"></canvas>
<script>
var sample = document.getElementById("sample");
function createSample() {
var ctx = sample.getContext('2d');
var width = sample.width, height = sample.height;
var pixels = ctx.getImageData(0, 0, width, height);
var data = pixels.data;
var size0 = 5, size1 = 8;
@yurydelendik
yurydelendik / gist:2831211
Created May 29, 2012
Setting up the shumway gh-pages
View gist:2831211
Per http://oli.jp/2011/github-pages-workflow/
Do Setting up GitHub Pages:
$ cd /path/to/fancypants
$ git symbolic-ref HEAD refs/heads/gh-pages
$ rm .git/index
$ git clean -fdx
$ echo "Shumway home" > index.html
$ git add .
@yurydelendik
yurydelendik / gist:3219490
Created Jul 31, 2012
Processing.js snippets
View gist:3219490
// ------ simple sketch
line(10, 10, 90, 90);
// ------ eye
void setup()
{
size(200, 200);
smooth();
}
View static-clone2.diff
diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -1424,17 +1424,17 @@ public:
*/
bool IsStaticDocument() { return mIsStaticDocument; }
/**
* Clones the document and subdocuments and stylesheet etc.
* @param aCloneContainer The container for the clone document.
@yurydelendik
yurydelendik / .htaccess
Last active Feb 5, 2019
CORS for pdf.js
View .htaccess
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "http://mozilla.github.io"
</IfModule>
@yurydelendik
yurydelendik / gist:3764535
Created Sep 21, 2012
alias for .git/config to squash commits
View gist:3764535
[alias]
squash = !sh -c 'git checkout mozilla/master && git merge --no-commit --squash $0 && git checkout -B $0 && git commit -e'
View gist:3934952
diff --git a/web/viewer.js b/web/viewer.js
index d1ed8d3..217ff85 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -1801,16 +1801,17 @@ var PageView = function pageView(container, pdfPage, id, scale,
element.style.height = Math.ceil(rect[3] - rect[1]) + 'px';
return element;
}
- function createCommentAnnotation(type, item) {
+ function createTextAnnotation(item) {
You can’t perform that action at this time.