Skip to content

Instantly share code, notes, and snippets.

@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
@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 [email protected]
npm info using [email protected]
@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 / jquery.ajaxIntercept.js
Last active July 17, 2020 22:13
Intercepts AJAX calls issued against a base URL and redirect them to other service
// jQuery.ajaxIntercept 0.2.0
// https://gist.github.com/prantlf/316c8dc3b80c3b2a0aad3be2d0d01a86
//
// Copyright (c) 2017 Ferdinand Prantl
// Licensed under the MIT license.
//
// Allows intercepting AJAX calls issued against a base URL
// and either redirect them to some other service, or compose
// the response by a custom asynchronous callback
@prantlf
prantlf / jquery.parseParams.js
Last active September 2, 2018 00:12
Reverses the $.param effect - parses the URL query part into an object
// jQuery.parseParams 0.1.0
// https://gist.github.com/prantlf/061e3911cd450491f84aac40292b7e7c
//
// Copyright (c) 2015-2017 Ferdinand Prantl
// Licensed under the MIT license.
//
// Reverses the $.param effect - parses the URL query part into an object
// with parameter names as keys pointing to parameter values; normalizes
// all parameter names to lower-case and saves multiple parameters with
// the same name to arrays
@prantlf
prantlf / require.config.js
Last active September 2, 2018 00:12
Loads JSON file, parses it to an object and passes it to require.config
// Loads JSON file, parses it to an object and passes it to require.config
//
// https://gist.github.com/prantlf/a7972320307580573eb715ed65e85a2b
// Copyright (c) 2016 Ferdinand Prantl
// Licensed under the MIT license.
//
// If you have a couple of pages and apply the same RequireJS configuration
// on them, you would like to maintain the configuration content at a single
// place. You could put the require.config statement to a script file and
// load it on the page by the script element before your main application
@prantlf
prantlf / deepClone.js
Last active September 2, 2018 00:12
JavaScript deepClone + integration to Undescore.js and Backbone.js
// Performs a deep clone of primitive values, arrays, object literals,
// and arbitrary objects, if requested. It is supposed to clone object
// literals, which are going to be modified, but the original should
// stay intact.
//
// The default behaviour works well with JSON REST API responses and
// and other objects, which contain only values of native types.
// If functions or HTML elements are encountered, they will not be
// actually cloned; they will be just copied, which works well with
// the typical options objects for Backbone constructors.
@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 / logger.js
Last active February 22, 2022 09:56 — forked from rtgibbons/logger.js
Logger Library with winston - Fixed for additional log arguments
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@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)

|