Skip to content

Instantly share code, notes, and snippets.

@tveimo
tveimo / gist:9ed80c181d80c449cc95dcf079c47cd6
Created July 19, 2023 13:32
test.mts, causes "RangeError: Maximum call stack size exceeded" with kontent-ai/kontent-delivery-node-parser, run with ts-node --esm test.mts
import { createRichTextHtmlResolver, Elements } from "@kontent-ai/delivery-sdk";
import { nodeParser } from "@kontent-ai/delivery-node-parser";
function test() {
const richTextElement = {
"images": [],
"linkedItemCodenames": [],
"linkedItems": [],
"links": [{
"codename": "n2023_24_budget",
@tveimo
tveimo / gist:9b8cbfaf2f2b527c2dec
Last active August 29, 2015 14:24
build openjdk 9 on osx with support for subpixel rendering on translucent surfaces
# building openjdk 9 on osx with subpixel antialiasing support for translucent surfaces
# openjdk 9 b70 from oracle already supports subpixel font rendering, just not for translucent surfaces
hg clone http://hg.openjdk.java.net/jdk9/jdk9 jdk9
cd ./jdk9
bash ./get_source.sh
cd jdk
# enable faster subpixel AA (this patch is now in OpenJDK 9 b76, so no longer required)
# curl http://cr.openjdk.java.net/~bae/8087201/9/webrev.01/jdk.patch | patch --dry-run -p1
@tveimo
tveimo / gist:5677ccc024afe115d4bc
Last active August 29, 2015 14:24
patch openjdk 9 b70 to support subpixel rendering on translucent surfaces
--- src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java-orig 2015-07-02 17:37:58.000000000 +1000
+++ src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java 2015-07-02 17:38:59.000000000 +1000
@@ -412,7 +412,7 @@
public boolean canRenderLCDText(SunGraphics2D sg2d) {
return
graphicsConfig.isCapPresent(CAPS_EXT_LCD_SHADER) &&
- sg2d.surfaceData.getTransparency() == Transparency.OPAQUE &&
+/* sg2d.surfaceData.getTransparency() == Transparency.OPAQUE && */
sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR &&
(sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY ||
@tveimo
tveimo / FileUpload.java
Created May 31, 2015 06:12
Example Spring MVC controller to accept file uploaded with https://gist.github.com/iampivot/6922245b057a7930e2d8
package example.controller;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@tveimo
tveimo / uploadtest.jsp
Last active November 29, 2017 20:50
single submit file upload example with the jquery file upload plugin: https://github.com/blueimp/jQuery-File-Upload
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//blueimp.github.io/jQuery-File-Upload/js/vendor/jquery.ui.widget.js"></script>
<script src="//blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
<script src="//blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
<script src="//blueimp.github.io/jQuery-File-Upload/js/jquery.iframe-transport.js"></script>
<script src="//blueimp.github.io/jQuery-File-Upload/js/jquery.fileupload.js"></script>
@tveimo
tveimo / netbeans-retina-slow
Last active August 29, 2015 14:09
example HTML file that scrolls with about 1 screen update per 2 seconds on OSX on my MBP Retina 15"
<!DOCTYPE html>
<html>
<head>
<title>glyphs preview</title>
<style>
/* Page Styles */
.glyph {