Skip to content

Instantly share code, notes, and snippets.

/**
* beautify_oscript.lxe - A code beautifier for OpenText Content Server OScript
*
* This script will beautify your OScript. Copy to a file within opentext/scripts/
* (e.g., opentext/scripts/beautify_oscript.lxe), restart Builder, place the focus on a
* script window, and run from the Tools menu.
*
* Some coding conventions assumed. Use at your own risk.
*
* Christopher Meyer (chris@schwiiz.org)
@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 / jasmine.toBeTypeOf.js
Last active September 2, 2018 00:13 — forked from adamyanalunas/jasmine.toBeTypeOf.js
A Jasmine matcher checking if the actual object is of the expected type
// Checks if the actual object is of the expected type;
// the string `expected` is handled case-insensitively.
//
// Example:
// expects(123).toBeTypeOf("Number");
jasmine.Matchers.prototype.toBeTypeOf = function(expected) {
var actual = this.actual,
notText = this.isNot ? ' not' : '',
objType = actual ? Object.prototype.toString.call(actual) : '';
this.message = function() {
@prantlf
prantlf / jasmine.toBeInstanceOf.js
Last active September 2, 2018 00:12
A Jasmine matcher checking if the actual object is an instance of the expected type
// Checks if the actual object is an instance of the expected type;
// the functional object `expected` can be any ancestor prototype.
//
// Example:
// expects(new Backbone.Model()).toBeInstanceOf(Backbone.Model);
jasmine.Matchers.prototype.toBeInstanceOf = function(expected) {
var actual = this.actual,
notText = this.isNot ? ' not' : '';
this.message = function() {
return 'Expected ' + actual + notText + ' to be an instance of ' + expected;
@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 / Northwind.js
Last active September 2, 2018 00:12
Helps obtaining and using a local copy of the Northwind database in MongoDB and testing an OData server with JayData
// Northwind database schema for JayData
//
// Initially generated by JaySvcUtil on 2014/07/27
// using http://services.odata.org/Northwind/Northwind.svc/$metadata
//
// Sample usage with a local Northwind database, which you can get
// by running northwind-create.js with mongodb, for example:
//
// var context = new NorthwindContext({
// name: 'mongoDB',
@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 / 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 / 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;
}