Skip to content

Instantly share code, notes, and snippets.

View yurydelendik's full-sized avatar

Yury Delendik yurydelendik

View GitHub Profile
@yurydelendik
yurydelendik / gist:3943011
Created October 24, 2012 00:37
Weird object creation
function p(t) {
for (var i in t) console.log(t[i]);
}
var obj1 = Object.create(null);
obj1[1] = "2";
obj1[3] = "4";
var obj2 = Object.create(null);
obj2.__proto__ = obj1;
@yurydelendik
yurydelendik / polystuff.html
Created October 25, 2012 01:51
Polygon stuff
<!DOCTYPE html>
<html>
<head>
<script>
function PolygonTracker() {
this.polygons = [];
this.currentPoints = [];
this.oddEvenRule = false;
this.APPROX_SECTIONS = 50;
}
@yurydelendik
yurydelendik / gist:4059975
Created November 12, 2012 15:30
Detection and removal merged origin branches
# list branches from origin
git branch -r | grep "origin/"
# show branches that are merge in the specific tree
git branch -r --contains origin/branchname | grep "mozilla/master"
# delete branch
git push origin :branchname
@yurydelendik
yurydelendik / stroke.html
Created November 16, 2012 14:52
stroke-to-path stuff
<!DOCTYPE html>
<html>
<head>
<script>
function strokeToPath(cmds, options) {
var CURVE_APPROX_POINTS = 10;
var CAP_APPROX_POINTS = 10;
function pushCurveApprox(points, args) {
var x0 = points[points.length - 1].x;
var y0 = points[points.length - 1].y;
@yurydelendik
yurydelendik / sugar.html
Created November 27, 2012 14:05
class sugar
<!DOCTYPE html>
<html>
<body>
<script>
function const_(val) {
return { value: val, writable: false, enumerable: true, configurable: true };
}
function prop_(get, set) {
return { get: get, set: set, enumerable: true, configurable: true };
}
@yurydelendik
yurydelendik / gist:4226470
Last active October 13, 2015 16:48
Pull/try from github particula branch without registering/fetching remote
[alias]
github-try = !sh -c 'git fetch https://github.com/$0/pdf.js.git $1 && git checkout FETCH_HEAD'
@yurydelendik
yurydelendik / playtone.html
Created January 3, 2013 00:51
Plays tone using Audio Data API and Web Audio API
<!doctype html>
<html>
<head>
<title></title>
<script>
diff --git a/browser/extensions/pdfjs/content/build/pdf.js b/browser/extensions/pdfjs/content/build/pdf.js
index acf7951..cb0bff7 100644
--- a/browser/extensions/pdfjs/content/build/pdf.js
+++ b/browser/extensions/pdfjs/content/build/pdf.js
@@ -20432,17 +20432,17 @@ Type1Font.prototype = {
}
};
var CFFFont = (function CFFFontClosure() {
function CFFFont(file, properties) {
@yurydelendik
yurydelendik / t1bin.diff
Created March 29, 2013 02:43
Converts PDF Type1 data to PFB file
diff --git a/src/fonts.js b/src/fonts.js
index fb5f541..fdde476 100644
--- a/src/fonts.js
+++ b/src/fonts.js
@@ -5514,6 +5514,16 @@ var Type1Font = function Type1Font(name, file, properties) {
this.charstrings = charstrings;
this.data = this.wrap(name, type2Charstrings, this.charstrings,
subrs, properties);
+
+ // creating Type1 binary file
@yurydelendik
yurydelendik / digits.html
Created April 16, 2013 16:50
Calculate number of appearance of the specific digit if the int numbers from 1 to max
<!DOCTYPE html>
<html>
<head>
<script>
function CalcDigits(stdlib) {
"use asm";
function howMany(n, digit) {
n = n|0;
digit = digit|0;