Skip to content

Instantly share code, notes, and snippets.

View JamesBoon's full-sized avatar
✏️
Edit status

JamesBoon

✏️
Edit status
View GitHub Profile
@JamesBoon
JamesBoon / IdnEmailExample.java
Created May 15, 2023 21:56
Create a normalized version of an email address containing UTF8 characters in the domain part according to IDNA2008.
package org.example;
// https://mvnrepository.com/artifact/com.ibm.icu/icu4j/73.1
import com.ibm.icu.text.IDNA;
// https://mvnrepository.com/artifact/com.sanctionco.jmail/jmail/1.5.0
import com.sanctionco.jmail.Email;
import com.sanctionco.jmail.EmailValidationResult;
import com.sanctionco.jmail.JMail;
public class IdnEmailExample {
@JamesBoon
JamesBoon / post-form-request.http
Last active August 13, 2023 11:51
IntelliJ IDEA HTTP Client x-www-form-urlencoded
### Send POST request with body as parameters
< {%
const props = {
email: 'test@example.com',
firstname: 'Test',
lastname: 'User',
company: 'Example & Co',
};
const body = Object.keys(props).map(function(key) {
@JamesBoon
JamesBoon / AppVisibleDirective.vue
Last active April 22, 2022 16:50
Some directives for Vue 3
<script setup>
import { ref } from 'vue'
const show = ref(true);
function toggleShow() {
show.value = !show.value;
}
// see https://github.com/vuejs/core/blob/v3.2.33/packages/runtime-dom/src/directives/vShow.ts
const vVisible = {
@JamesBoon
JamesBoon / README.md
Last active March 10, 2022 09:08
A bash script to create a `favicon.ico` via Imagemagick

A bash script to create a favicon.ico via Imagemagick.

Usage:

./favicon.sh myimage.png

Creates a favicon.ico file in the same folder.

@JamesBoon
JamesBoon / waitForElementClickable.js
Created January 3, 2018 15:10
Custom nightwatch command waitForElementClickable()
var util = require('util');
var WaitForElementVisible = require('nightwatch/lib/api/element-commands/waitForElementVisible');
function WaitForElementClickable() {
WaitForElementVisible.call(this);
this.expectedValue = 'clickable';
}
util.inherits(WaitForElementClickable, WaitForElementVisible);