Skip to content

Instantly share code, notes, and snippets.

@martinandersen3d
martinandersen3d / IntegrationTest.cs
Created April 24, 2022 01:12 — forked from Elfocrash/IntegrationTest.cs
ASP.NET Core Integration tests code from my video: https://www.youtube.com/watch?v=7roqteWLw4s
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Tweetbook.Contracts.V1;
using Tweetbook.Contracts.V1.Requests;
using Tweetbook.Contracts.V1.Responses;
@martinandersen3d
martinandersen3d / Converting NUnit to XUnit.md
Last active April 24, 2022 00:04 — forked from yetanotherchris/first-steps.md
Converting NUnit to XUnit
  • Get VS Code
  • Remove using NUnit.Framework;
  • Add using XUnit;
  • Replace all [Test] with [Fact]
  • Replace [SetUp] with a constructor
  • Replace Assert.That(actualValue, Is.EqualTo(value)); with Assert.Equal(expected, actual)
    • highlight Is.EqualTo(
    • Delete it
    • Select to the end of the line
  • Ctrl + X
@martinandersen3d
martinandersen3d / nautilusScript.md
Last active March 13, 2022 21:26 — forked from Dirack/nautilusScript.md
nautilus hotkeys shortcuts

Create a script called Terminal (yes, without a extension) inside the folder ~/.local/share/nautilus/scripts with the following content:

Create File: /home/m/.local/share/nautilus/scripts/Termial

#!/bin/sh
gnome-terminal
@martinandersen3d
martinandersen3d / fixlocale.sh
Created July 2, 2021 03:28 — forked from ChrisTitusTech/fixlocale.sh
Fix Locales in any distro
#!/bin/bash
echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
echo "LANG=en_US.UTF-8" | sudo tee -a /etc/locale.conf
sudo locale-gen en_US.UTF-8
@martinandersen3d
martinandersen3d / sync-time.sh
Created May 2, 2021 01:03 — forked from dungsaga/sync-time.sh
sync local clock in bash without NTP
# I want to sync the local clock but don't have access to any NTP server.
# Websites such as https://time.is give me the correct time and I can manually adjust the local clock.
# But then I recall that a HTTP response often contains a date header with current time in GMT timezone.
# I'll use it to set the system clock with the precision of 1 or 2 seconds.
# in Linux
sudo date -us "$(curl -Is google.com | grep '^Date:' | cut -d' ' -f3-)"
# in Linux with fish shell
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.
@martinandersen3d
martinandersen3d / ApiRespond.php
Created March 21, 2020 13:28 — forked from dugajean/ApiRespond.php
Trait for easy creation of API responses
<?php
namespace App\Traits;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
trait ApiRespond
{
/**
@martinandersen3d
martinandersen3d / FullTextSearch.php
Created March 21, 2020 13:27 — forked from vijaybajrot/FullTextSearch.php
Full Text Search In Mysql and Laravel
<?php
namespace App\Traits;
trait FullTextSearch
{
/**
* Replaces spaces with full text search wildcards
*
* @param string $term
@martinandersen3d
martinandersen3d / FileTrait.php
Created March 21, 2020 13:27
Download File and get FileName methods Laravel Framework
<?php
namespace App\Traits;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
trait FileTrait
{