Skip to content

Instantly share code, notes, and snippets.

View maticrivo's full-sized avatar

Matias Crivolotti maticrivo

View GitHub Profile
@maticrivo
maticrivo / epub.css
Created January 10, 2018 08:30 — forked from bmaupin/epub.css
You Don't Know JS Ebooks
body {
text-align: justify;
}
code, pre {
font-family: "Hack", monospace;
}
h1, h2, h3, h4, h5, h6 {
text-align: left;
import os
import time
import sys
import unittest
from appium import webdriver
class TestCase(unittest.TestCase):
@maticrivo
maticrivo / qpdf.sh
Last active August 29, 2015 14:10 — forked from amirnissim/qpdf.sh
brew install qpdf
# first decrypt
qpdf --decrypt --password=mypass <FILE_NAME> dec-<FILE_NAME>.pdf
# merge
qpdf --empty --pages dec*.pdf -- all.pdf
//Open the file directly in the browser and run this script from the console
//Assumptions: The browser uses a <pre/> tag for showing the CSS code
var file = document.querySelector("pre");
var fileContent = file.innerHTML;
var newContent = fileContent.replace(/([\d.]+)(px)/g, function(m){
var measure = parseFloat(m.split("px")[0]);
var newMeasure = measure / 10;
newMeasure = newMeasure.toFixed(2);
newMeasure = newMeasure.replace(/(\.[0-9]*?)0+$/, "$1"); // remove trailing zeros