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 / 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 / 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 / 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 / japanese-font-family.md
Last active November 7, 2022 09:02 — forked from vanquang9387/japanese-font-family.md
Japanese default css font family

Most Japanese websites use default font sets provided on Windows, Mac or Ubuntu. The latest ones are Meiryo, Hiragino Kaku Gothic Pro and Noto. For older versions such like Windows XP, it is good to add former default fonts MS Gothic(or MS Mincho)/Osaka. Older Linux versions may include Takao fonts.

Some old browsers could not understand those font names in English, some others do not recognize the names in Japanese, so it is safe to write both in Japanese and English.

Meiryo and Hiragino's order is, because Mac users may have Meiryo from MS-Office, and Hiragino is more familiar and matching well on Mac, better by starting Hiragino series.

So the current recommended practice is like this:

font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", Osaka, メイリオ, Meiryo, "MS Pゴシック", "MS PGothic", "MS ゴシック" , "MS Gothic", "Noto Sans CJK JP", TakaoPGothic, sans-serif;
@prantlf
prantlf / Mac OSX Setup - Brew
Created November 15, 2018 18:02 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
@prantlf
prantlf / install_ruby_with_rbenv.md
Last active December 3, 2018 16:23 — forked from stonehippo/install_ruby_with_rbenv.md
Installing a new Ruby with rbenv on Mac OS

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

@prantlf
prantlf / color-conversion-algorithms.js
Created February 25, 2019 01:12 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@prantlf
prantlf / nginx.conf
Last active September 29, 2019 12:15 — forked from foxxyz/nginx.conf
Serve current directory via nginx
# Simple development setup to serve a directory at http://localhost:9001.
# Start nginx in the directory to serve with `nginx -c ~/nginx.conf`.
# When using a laptop with an above average equipment. 2 workers
# significantly increase the throughput. 4 workers still help
# noticeably. The server slows down With more than 6 workers.
worker_processes 2;
events {
accept_mutex off;
}