Skip to content

Instantly share code, notes, and snippets.

Christopher Meyer chriscdn

View GitHub Profile
chriscdn / asyncArray.js
Last active Apr 9, 2019
A JavaScript Array forEach and map implementation to minimise UI blocking.
View asyncArray.js
// Curious to know more? Read here:
export function asyncForEach(items, cb) {
return new Promise(resolve => {
items.forEach((item, index, items) => {
// This is async such that we can add an await on cb.
// This ensures resolve() is called after the last iteration has completed.
setTimeout(async () => {
await cb(item, index, items)
if (index == items.length - 1) {
chriscdn /
Last active Jul 24, 2018 — forked from paumoreno/
Extract all messages from a Vue.js with vue-i18n app, using gettext-extractor.


This script uses the great message extraction library gettext-extractor by lukasgeiter.

The script assumes that the location of the source files is ./src. It parses both .js and .vue files. It writes the PO template file in ./i18n/messages.pot.

Some things to note:

  • It assumes that interpolations in the templates use the delimieters {{}} (it is the most commmon case).
  • It assumes that both the template and the script sections of the .vue single file components are defined inline, and not referenced by a src attribue (it is the most common case).
chriscdn / valueForKeyPath.js
Last active Mar 19, 2018
A valueForKeyPath function for JavaScript objects
View valueForKeyPath.js
function valueForKeyPath(obj, keypath) {
return keypath.split('.').reduce(function(previous, current) {
return (previous != undefined) && (typeof previous === 'object') && (current in previous) ? previous[current] : undefined;
}, obj);
chriscdn /
Created Nov 12, 2015 — forked from tomchristie/
PUT-as-create mixin class for Django REST framework.
class AllowPUTAsCreateMixin(object):
The following mixin class may be used in order to support PUT-as-create
behavior for incoming requests.
def update(self, request, *args, **kwargs):
partial = kwargs.pop('partial', False)
instance = self.get_object_or_none()
serializer = self.get_serializer(instance,, partial=partial)
chriscdn / CLLocation+rhextensions.h
Last active Aug 17, 2018
A CLLocation category for determing the time zone from a location.
View CLLocation+rhextensions.h
// CLLocation+rhextensions.h
// Copyright (C) 2015 by Christopher Meyer
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
chriscdn / CS10.0 Logout Link
Created Oct 16, 2014
In later versions of CS10.0 a secure token is required for logout. This snippet can be placed in the appearance header to extract the logout link and execute it.
View CS10.0 Logout Link
chriscdn / super.lxe
Last active Aug 29, 2015
A function for making super calls in OpenText Content Server OScript.
View super.lxe
* Christopher Meyer
* Copyright 2014 Red House Consulting GmbH
* Version: 1.3
function Dynamic super(Object item, String func)
switch GetMethodType(item, func)
chriscdn / beautify_oscript.lxe
Last active Sep 2, 2018
beautify_oscript.lxe - A code beautifier for OpenText Content Server OScript
View beautify_oscript.lxe
* 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 (
You can’t perform that action at this time.