Skip to content

Instantly share code, notes, and snippets.

@nekman
nekman / aidon6534-slimmelezer.md
Last active November 28, 2022 08:56
SlimmeLezer+ with Aidon 6534 (communication module 6442 S) energy meter

SlimmeLezer+ with Aidon 6534 (communication module 6442 S) energy meter

Bought a SlimmeLezer+ to read data from the energy meter Aidon 6534.

Installed it according to the guide. Got power from the HAN-port using the provided serial cable, but I also needed to connect it to the USB-C to get it to work well.

Once setup and connected, I used the web interface to discover that it could not parse the data from the energy meter. The following error message was displayed in the log:

@nekman
nekman / swedish-social-security-regexp.js
Created July 1, 2011 09:33
Simple JS regexp for swedish social security number
/*NOTE:
This is just a simple pattern check, so: /^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test("000000 0000") // true
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test('195505055555'); // true
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test('19550505-5555'); // true
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test('550505-5555'); // true
/^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test('550505 5555'); // true
@nekman
nekman / polyfill.js
Last active December 3, 2021 19:35
polyfill.io IE11
/* Polyfill service v3.16.0
* For detailed credits and licence information see https://github.com/financial-times/polyfill-service.
*
* UA detected: ie/11.0.0
* Features requested: default
*
* - Array.from, License: CC0 (required by "default")
* - Array.of, License: MIT (required by "default")
* - Array.prototype.fill, License: CC0 (required by "default")
* - Event, License: CC0 (required by "default", "CustomEvent", "Promise")
@nekman
nekman / jsf.md
Last active June 19, 2020 10:41
Don't use JSF

JSF?!

http://www.thoughtworks.com/radar/#/languages-and-frameworks/683 - ThoughtWorks Technology Radar - January 2014

We continue to see teams run into trouble using JSF -- JavaServer Faces -- and are recommending you avoid this technology. Teams seem to choose JSF because it is a J2EE standard without really evaluating whether the programming model suits them. We think JSF is flawed because it tries to abstract away HTML, CSS and HTTP, exactly the reverse of what modern web frameworks do. JSF, like ASP.NET webforms, attempts to create statefulness on top of the stateless protocol HTTP and ends up causing a whole host of problems involving shared server-side state. We are aware of the improvements in JSF 2.0, but think the model is fundamentally broken. We recommend teams use simple frameworks and embrace and understand web technologies including HTTP, HTML and CSS.


http://www.jfokus.se/jfokus/talks.jsp - Search for JSF... (one hit on why you should leave it)
http://architecture-musings.blo
@nekman
nekman / API.md
Created January 21, 2020 14:33 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@nekman
nekman / tdr-response.json
Created March 1, 2019 11:52
Search for:
{
"data": [
{
"id": "doc000015805",
"type": "documents",
"attributes": {
"publicationType": "OM",
"publicationTitle": {
"en": "Husqvarna T535iXP"
},
/**
*
* Methods and member ordering (proposal).
*
*/
public class Example implements Closeable {
// 1. Public static final constants
public static final String CONSTANT = "";
@nekman
nekman / node-esm.md
Last active September 29, 2018 11:59
Node.js with esm and app-module-path (using mocha as test runner)

Node.js with esm and app-module-path

This is a short post on how to use ESM with app-module-path in a Node.js (6+) project.

Q: Why?

Lots of benifits, easier to export/import modules.

Instead of:

console.log(...Object.entries(window.localStorage))
@nekman
nekman / keyValueCache.js
Created October 25, 2011 17:55
Simple javascript key/value cache
/*
cache.set(<key>, <value>)
cache.set({ <key1> : <value1>, <keyN> : <valueN> });
cache.get(<key>, <optional|defaultvalue>) => <value>
Example:
cache.set({ foo : 'bar' });
cache.get('foo'); //'bar'