Skip to content

Instantly share code, notes, and snippets.

[
{
"or": [
{
"and": [
{
"key": "contentType",
"term": "regular"
},
{
// The standard chrome points per pixel value
const chromePPI = 96;
function mmToInch(mm) {
return mm / 25.4;
}
// this is NZZ print specific
const columnGap = 5;
const columnWidth = 54.2;
@benib
benib / promote-to-black.js
Last active October 27, 2019 18:10
Promote mostly black pixels to K only in a CMYK TIFF
function promoteTiffBufferToBlack(tiffBuffer) {
const ifds = UTIF.decode(tiffBuffer);
// tiff tag descriptions: https://www.loc.gov/preservation/digital/formats/content/tiff_tags.shtml
// tiff image file format: http://www.fileformat.info/format/tiff/corion.htm
const bitsPerSample = ifds[0].t258;
const stripOffsets = ifds[0].t273[0];
const stripByteCounts = ifds[0].t279[0];
@benib
benib / vegaspec.json
Last active March 14, 2018 13:42
Vega Barchart autosize fit-x grid problem
{
"width": 500,
"autosize": {
"type": "fit-x",
"contains": "padding"
},
"signals": [
{
"name": "barWidth",
"value": 24
@benib
benib / orakel.js
Created May 18, 2016 15:41
NZZ Euro 2016 Orakel Algorithmus
/*
NZZ Euro 2016 Orakel
http://nzz.ch/-ld.17757
The algorithm
this works like this:
@benib
benib / SassMeister-input.scss
Last active August 29, 2015 14:06
Generated by SassMeister.com.
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
//
// use this together with modernizr feature detection
//
@mixin supports-feature($feature) {
.#{$feature} & {
@benib
benib / gist:6574438
Created September 15, 2013 21:23
Replace filenames after grunt-filerev
grunt.registerMultiTask('filerevreplace', 'filerev task', function() {
var files = grunt.file.expand(this.files[0].src)
var assets = grunt.filerev.summary;
for (var i = 0, length = files.length; i < length; i++) {
var fileContent = grunt.file.read(files[i]);
for (var key in assets) {
origArr = key.split('/');
origFile = origArr[origArr.length-1];
revArr = assets[key].split('/');
revFile = revArr[revArr.length-1];
module Jekyll
class CategoryAwarePrevNextGenerator < Generator
safe true
priority :high
def generate(site)
site.categories.each_pair do |category_name, posts|
posts.sort! { |a, b| a <=> b }
@benib
benib / hafasXMLInterface.xsd
Created April 5, 2012 10:35
hafasXMLInterface.xsd
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by rhu@hacon.de (HaCon Ingenieurges. mbH) -->
<!-- ======================================================================= -->
<!-- location validation request/result -->
<!-- connection request/result -->
<!-- connection scroll request/result -->
<!-- ======================================================================= -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="ReqC">
<xs:annotation>