Skip to content

Instantly share code, notes, and snippets.

@atsu85
atsu85 / PropertiesConfigurationTest.java
Last active October 9, 2019 07:57
This JUnit test shows that saving PropertiesConfiguration with UTF-8 charset results in file containing unicode escapes of UTF-8 characters instead of UTF-8 characters
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Properties;
import org.apache.commons.configuration.PropertiesConfiguration;
C:\tmp\proj\cloned>mkdir systemjs_814 && cd systemjs_814 && git clone git@github.com:atsu85/skeleton-navigation.git && cd skeleton-navigation && git checkout systemjs#814-stillNotResolved && rm -rf dist jspm_packages node_modules && npm install && jspm install && jspm dl-loader --latest && gulp watch
Cloning into 'skeleton-navigation'...
remote: Counting objects: 1302, done.
rRemote: Total 1302 (delta 0), reused 0 (delta 0), pack-reuseceiving objects: 73% (951/1302), 180.01 KiB | 110.00 KiB/s ed 1302
Receiving objects: 100% (1302/1302), 277.94 KiB | 114.00 KiB/s, done.
Resolving deltas: 100% (751/751), done.
Checking connectivity... done.
Branch systemjs#814-stillNotResolved set up to track remote branch systemjs#814-stillNotResolved from origin.
Switched to a new branch 'systemjs#814-stillNotResolved'
npm install && jspm install && jspm dl-loader --latest && gulp watch
Switched to branch 'systemjs#814-stillNotResolved'
Your branch is up-to-date with 'origin/systemjs#814-stillNotResolved'.
npm WARN deprecated CSSselect@0.4.1: the module is now available as 'css-select'
npm WARN optional dep failed, continuing fsevents@1.0.2
npm WARN optional dep failed, continuing fsevents@1.0.2
npm WARN deprecated CSSwhat@0.4.7: the module is now available as 'css-what'
-
import {valueConverter} from "aurelia-binding";
/** useful for debugging */
@valueConverter('json')
export class ToJsonValueConverter {
toView(value: any) {
return value ? JSON.stringify(value) : value;
}
export class CustomElementUtil {
/**
* workaround for @containerless subclasses (custom elements) - waiting for https://github.com/aurelia/templating/issues/140
* @return previousElementSibling when given element is comment node (as it is in case of @containerless custom elements) or given element otherwise
*/
public static getRealElement(element: Element): Element {
if(element.nodeType === 8) {
element = this.getPreviusElementSibling(element)
}
/**
* Author: Ats Uiboupin, see https://github.com/jmesnil/stomp-websocket/issues/61
* it is possible to use other type of WebSockets by using the Stomp.over(ws) method. This method expects an object that conforms to the WebSocket definition.
* TODO specifi minimal required object structure, see SockJS as an acceptable example: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/sockjs/sockjs.d.ts#L23
*/
declare type StompMinimalWebSocketDefinition = any;
declare type StompWebSocketDefinition = WebSocket | StompMinimalWebSocketDefinition | SockJS;
declare type StompHeaders = { [key: string ]: string;};
declare type StompSubscriptions = { [key: string ]: string;};
@atsu85
atsu85 / build.js
Last active February 12, 2016 20:19
example, how to create separate gulp tasks for compilling main or e2e-test typescript sources to javascript
// contains just a gulp task that compiles main application TypeScript code to Javascript
var paths = require('../paths');
var typeScript = require('../typeScript.js');
gulp.task('build-typescript', function() {
// exclude test typescript sources from paths defined in tsconfig.json
return typeScript.builder({}, paths.output, [], paths.testTsSourceFilesGlob);
});
@atsu85
atsu85 / app.html
Last active May 19, 2016 16:06
Aurelia Gist
<template>
<h1>this video is being played twice if the autoplay attribute isn't bound to VM property. Pause and see</h1>
<video src="http://video.webmfiles.org/big-buck-bunny_trailer.webm"
ref="player" loop controls autoplay="${autoplay}"></video >
</template>
<template>
<div repeat.for="person of persons">
<span with.bind="person" element.ref="el">
${firstName} ${middleName} ${lastName}
</span>
</div>
app.el = ${el} <-- this (global el) should be null
<br/>
person[0].el = ${persons[0].el}
<br/>
@atsu85
atsu85 / app.html
Created July 4, 2016 11:27 — forked from anonymous/app.html
Aurelia view engine hooks
<template>
<p>How to get selected checkbox values to array?</p>
<p>Follwoging <a href="http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/cheat-sheet/5" target="_blank">sample</a> isn't workign:</p>
<label repeat.for="color of colors">
<input type="checkbox" value.bind="color" checked.bind="$parent.favoriteColors" />
${color}
</label>
<p>PROBLEM: expecting array of selected values, not boolean: favoriteColors=${favoriteColors}</p>
</template>