Skip to content

Instantly share code, notes, and snippets.

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 4, 2024 11:33
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
<#
.NOTES
Licensed under WTFPL, Version 2.
.SYNOPSIS
Extracts the DB-schema from the latest EF migration in the specified database.
.DESCRIPTION
Writes the extracted schema to the output file in the EDMX format.
The "(local)" server is used.
.PARAMETER Database
The database with EF migrations (in the __MigrationHistory table).
@andrewimm
andrewimm / package.json
Created May 15, 2017 18:12
Simple yarn create, if your CLI just takes a stream of arguments
{
"name": "create-your-app",
"bin": "./node_modules/.bin/your-app-cli",
"dependencies": {
"your-app-cli": "*"
}
}
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@luciddreamz
luciddreamz / keycloak.sh
Last active February 27, 2024 05:26 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example: Get User
#!/bin/bash
# requires https://stedolan.github.io/jq/download/
# config
KEYCLOAK_URL=http://localhost:8080/auth
KEYCLOAK_REALM=realm
KEYCLOAK_CLIENT_ID=clientId
KEYCLOAK_CLIENT_SECRET=clientSecret
USER_ID=userId
@AngeloAnolin
AngeloAnolin / web.config
Created March 11, 2017 02:56
Web Configuration for Vue Applications Hosted in IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/500" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
@kuhlenh
kuhlenh / .editorconfig
Created December 9, 2016 18:49
BlogEditorConfig_CodeStyleSnippet
# CSharp code style settings:
[*.cs]
csharp_style_var_for_built_in_types = true:none
@foolip
foolip / document.md
Last active September 20, 2018 00:33
Document interfaces
@alex-mtx
alex-mtx / console.readline.shortcut.snippet
Last active November 14, 2019 06:30
Console.ReadLine() shortcut
<!-- save it under %USERPROFILE%\Documents\Visual Studio 2015\Code Snippets\Visual C#\My Code Snippets. -->
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Insert Console.ReadLine()</Title>
<Shortcut>crl</Shortcut>
<Description>Code snippet for Console.ReadLine</Description>
<Author>Stack Overflow User</Author>
<SnippetTypes>
@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)