Skip to content

Instantly share code, notes, and snippets.

Avatar
☯️

Martin Jensen martinloesethjensen

☯️
View GitHub Profile
@martinloesethjensen
martinloesethjensen / StringExtension.kt
Last active February 12, 2022 15:01
Kotlin string extension to apply https prefix to string.
View StringExtension.kt
/**
* Adds https prefix if link does not have prefix. It will also change old prefix http to https.
* @return link/url with https prefix
*/
fun String.toHttpsPrefix(): String? = if (isNotEmpty() && !startsWith("https://") && !startsWith("http://")) {
"https://$this"
} else if (startsWith("http://")) {
replace("http://", "https://")
} else this
@martinloesethjensen
martinloesethjensen / flutter-commands.md
Last active January 19, 2020 21:58
Useful Flutter Commands
View flutter-commands.md

Useful terminal commands

These are some of the useful terminal commands used when developing Flutter apps. Supported IDE's have Flutter plugins, so it's as easy as pressing a run button in the IDE.

Check Flutter version

flutter --version

Open simulator on a macOS through the terminal

@martinloesethjensen
martinloesethjensen / UserTest.kt
Last active March 19, 2020 22:17
Kotlin Unit Testing with JUnit and Kluent
View UserTest.kt
import org.amshove.kluent.`should be`
import org.amshove.kluent.shouldBeFalse
import org.amshove.kluent.shouldBeTrue
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
class UserTest {
private val user = User(1, "Alice")
@Test
@martinloesethjensen
martinloesethjensen / bitrise_command.md
Last active March 27, 2020 20:39
How to run bitrise script for the creation of new app with fish shell
View bitrise_command.md

Bitrise command propersition

It might be beneficial to use this command below so more shells can run the command without having to change the command.

bash -c ""

This will run on at least fish, zsh and bash shell

@martinloesethjensen
martinloesethjensen / dart_script.dart
Created November 5, 2020 14:49
Script to calculate pending payouts by sending HTTP requests to a local Sidecar instance.
View dart_script.dart
import 'package:args/args.dart';
import 'package:http/http.dart' as http;
import 'dart:convert' as convert;
/// KSM Precision [kusama guide](https://guide.kusama.network/docs/en/kusama-parameters#precision)
const ksmPrecision = 1000000000000;
void main(List<String> args) async {
var parser = ArgParser();
var authorId;
View VolcanoCoin.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract VolcanoCoin {
uint256 totalSupply = 10000;
address owner;
modifier onlyOwner {
View MyCryptoProfile.md

Linking my account martinloesethjensen on GitHub with my address 5HNpf9ydo2C2TFBS1frahQeNDVdG2QABGckGsBNKxPq44Mgb on Substrate in mycryptoprofile.io, and the challenge code is: 600c7a1d9f570466a81a36e7eb2e3d6a. #LitentryVerifyMyAddress