Skip to content

Instantly share code, notes, and snippets.

@prantlf
prantlf / uglify2_issue_503.js
Created July 1, 2014 19:45
A hand-made AMD version of log4javascript.js demonstrating the https://github.com/mishoo/UglifyJS2/issues/503
/**
* Copyright 2013 Tim Down.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@prantlf
prantlf / DMS with MongoDB + OData with JayData - Tree.md
Last active August 29, 2015 14:06
Exposing meta-data from a simple DMS stored in MongoDB by OData based on JayData

How to expose meta-data from a simple DMS (Document Management System) stored in the MongoDB database by an OData service implemented with the help of JayData.

This is a minimum sample showing how to build a tree of folders and documents, where folders can be nested and every folder and document points to its parent. A full DMS would include more properties.

The actual folder+document hierarchy:

/--- Projects         (root folder)
  |
  +--- Mollie         (sub-folder)

|

@prantlf
prantlf / fix-developer.opentext.com
Created April 6, 2015 20:15
Fixes too light colour in comment-editing textarea on developer.opentext.com
#wmd-input {
color: #000;
}
@prantlf
prantlf / base64.hpp
Last active December 21, 2015 12:18 — forked from nico159/base64.hpp
Interface for stateful and stateless BASE64 encoding. (Maintaining the encoding state is needed when encoding chunked or stream input.)
#ifndef BOOST_NETWORK_UTILS_BASE64_ENCODE_HPP
#define BOOST_NETWORK_UTILS_BASE64_ENCODE_HPP
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <algorithm>
#include <iterator>
#include <string>
namespace boost {
@prantlf
prantlf / base64_usage.cpp
Created September 15, 2013 14:21
Use case for the BASE64 encoding
/*
USE CASE: Set the Authorization header value in the HTTP response
to the Basic Authentication challenge.
EXAMPLE: Request headers:
WWW-Authenticate: Basic realm="WallyWorld"
Response headers:
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
*/
@prantlf
prantlf / selenium.test.js
Last active March 28, 2018 01:04
Script to reproduce the chromedriver process not stopping for https://github.com/vvo/selenium-standalone/issues/351
const selenium = require('selenium-standalone')
const webdriverio = require('webdriverio')
const configuration = {
version: '3.8.1',
baseURL: 'http://selenium-release.storage.googleapis.com',
drivers: {
chrome: {
version: '2.37',
arch: process.arch,
@prantlf
prantlf / npm.log
Created June 18, 2018 06:19
vnu-jar@dev cannot be found
ferdipr@de08365:~/0 npm i vnu-jar@dev --verbose --no-color
npm info it worked if it ends with ok
npm verb cli [ '/home/ferdipr/.nvm/versions/node/v8.11.2/bin/node',
npm verb cli '/home/ferdipr/.nvm/versions/node/v8.11.2/bin/npm',
npm verb cli 'i',
npm verb cli 'vnu-jar@dev',
npm verb cli '--verbose',
npm verb cli '--no-color' ]
npm info using npm@6.1.0
npm info using node@v8.11.2
@prantlf
prantlf / can-be-seen.js
Last active September 2, 2018 00:10
Check, that an element can be really seen in the browser window
// Checks, that the element is not only visible in DOM,
// but that it can be really seen either in the window,
// or only in the visible part of the windows (viewport).
// The centre of the element has to be seen, at least.
function canBeSeen (element, inViewPort) {
// Filter out hidden elements
if (element.offsetHeight === 0) {
return false
}
// Get extents of the viewport
@prantlf
prantlf / ttc2ttf
Created July 19, 2018 04:35 — forked from lilydjwg/ttc2ttf
Convert .ttc to several .ttf files into the current directory
#!/usr/bin/env python2
import sys
import fontforge
def main(file):
for font in fontforge.fontsInFile(file):
f = fontforge.open(u'%s(%s)' % (file, font))
f.generate('%s.ttf' % font)
@prantlf
prantlf / upgrade-npms.sh
Created June 18, 2018 21:50
Upgrade npm dependencies semi-automatically
git pull --all && ncu -au && npm i && npm test
git commit -a -m "chore: Upgrade development npm module dependencies" && git push --all