Skip to content

Instantly share code, notes, and snippets.

View victorjonsson's full-sized avatar
🎯
Focusing

Victor Jonsson victorjonsson

🎯
Focusing
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
</head>
<body class="p-5" onload="renderLog(document.getElementById('the-log').value)">
document.write(
[...document.querySelectorAll('img')]
.filter(node => node.src?.indexOf('qa.jollyroom.se') > -1)
.map(node => node.src.split('?')[0].replace('qa.jollyroom.se', 'qa.jollyroom.shimmercat.cloud'))
.map(shimmerCatSrc => '<img src="'+shimmerCatSrc+'">').join('')
);
var decision = new NavetDecisionBasis()
{
Person = new NavetPerson()
{
Contact = new NavetPersonContact()
{
CellPhone = "",
City = "Umea",
Country = "Sweden",
// Turn our form data into a JSON string
const data ={
...
data: {
...
integrations: [
{type: 'integrationX' ... },
{type: 'integrationY' ... }
]
}
public SomethingController([FromBody] MyDataModel model) {
try {
DoTheStuff(model);
} catch (SpecificExceptionIKnowCanHappen exc) {
return BadRequest(new { errorCode = ErrorCode });
}
// all other exceptions will let the app crash, exception info will be sen to log and app returns status 500 to the client
return Ok();
}
// Controller exempel
public class AccountController : Controller
{
public async Task<IActionResult> kollaStatusPåBankIdInloggningen(string reference) {
// ... massa saker händer...
AuthResult result = authClient.AuthorizeReference(...)
@victorjonsson
victorjonsson / statement-validator.js
Last active May 11, 2017 10:28
statement-validator.js
$.formUtils.addValidator({
name: 'statement',
validatorFunction : function(value, $elem, conf, language, $form, eventContext) {
var statementIsValid = true,
$resultTree = $('<result><node></node></result>'),
$current = $resultTree.children().eq(0),
invokeNext = true;
$.each(value.replace(/\s+/g,' ').split(' '), function (i, str) {
if (str == '||') {
invokeNext = true;
@victorjonsson
victorjonsson / fsm.php
Last active November 11, 2016 15:22
fsm.php
<?php
interface State {
public function getState();
}
abstract class StateAbstract implements State {
const STATE_INIT = 'STATE_INIT';
<?php
namespace Routing\Auth;
abstract class AuthChecker {
const SKIPPED;
const SUCCESS;
const AUTHENTICATION_FAILED;
const AUTHORIZATION_FAILED;
<?php
/**
*
* @example
* <?php
*
* class Day extends EnumeratedType
* {
* const MONDAY = 'Monday';