Skip to content

Instantly share code, notes, and snippets.

View HelgeSverre's full-sized avatar
🧠
LLMs gonna take our jewrbs.

Helge Sverre HelgeSverre

🧠
LLMs gonna take our jewrbs.
View GitHub Profile
@HelgeSverre
HelgeSverre / the-only-google-result.txt
Created March 30, 2022 19:22
CustomerInvoiceValidationTotalAmountNotAllowedToBeZeroOrMore - explained
When creating a credit note via the eAccounting API v2 you have to make
the quantity a negative number or else you will get this error:
CustomerInvoiceValidationTotalAmountNotAllowedToBeZeroOrMore
@HelgeSverre
HelgeSverre / fix.sh
Created March 11, 2022 14:39
Docker for Desktop on Mac out of space
# Wipe the entire "VM" and rebuild everything
rm ~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw
@HelgeSverre
HelgeSverre / brreg.php
Created March 2, 2022 12:20
Laravel Brønnøysundregistrene - Brreg
<?php
use Illuminate\Support\Facades\Http;
class Brreg
{
public function getByVatId($vatId)
{
@HelgeSverre
HelgeSverre / vue-moment-workarounds.md
Last active July 30, 2020 17:16
How to fix vue-moment locale issues and reactivity in Vue

Problem 1

If you are dynamically changing the locale of your vue application and setting the locale of moment js to that locale, your formatted dates will not be re-rendered, this is due to moments locale not being reactive (vue doesnt know that moment's internal state changed)

Solution

We need to create a custom renderless component that wraps the functionality we want, and whenever

@HelgeSverre
HelgeSverre / mysql-sorting-norwegian.md
Last active March 21, 2020 10:28
How to make sorting work properly for Norwegian characters in MySQL - Æ Ø Å

If you have an issue with "order by " not working correctly with norwegian characters eg:

table: names

  • Andreas
  • Betty
  • Øystein
  • Ole martin
  • Ylvis
  • Åse Hansen
@HelgeSverre
HelgeSverre / main.dart
Created November 2, 2019 15:00
utf8 decode error
import 'dart:convert';
import 'dart:typed_data';
void main() {
var name = "A string containing ø";
var bytes = Uint8List.fromList(name.codeUnits);
var decoded = json.decode(utf8.decode(bytes));
print(decoded);
@HelgeSverre
HelgeSverre / craft-save-plugin-settings.php
Last active April 4, 2018 11:40
How to update a setting attribute for a CraftCMS plguin
<?php
$plugin = craft()->plugins->getPlugin('pluginHandle');
// This does NOT work.
$plugin->getSettings()->setAttribute("attributename", "attribute value");
// Do this instead!
<?php
namespace App\Http\Middleware;
use App\Tenant;
use Closure;
use HipsterJazzbo\Landlord\Facades\Landlord;
class TenantHostnameScope
{
<?php
namespace App\Http\Middleware;
use App\User;
use Auth;
use Closure;
use HipsterJazzbo\Landlord\Facades\Landlord;
class TenantScope
@HelgeSverre
HelgeSverre / retry-for-loop.php
Created February 15, 2017 07:49
Simple Retrying for loop example
<?php
$retries = 0;
$maxRetries = 3;
// Should fail this amount of times
$failCounter = 5;
for($i = 0; $i < 10; $i++) {