This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Useful when bundling an app using Microsoft.EntityFrameworkCore.Sqlite, which depends on SQLitePCLRaw.bundle_green, which depends on SQLitePCLRaw.lib.e_sqlite3.v110_xp (having native Windows dlls) --> | |
<ItemGroup> | |
<EmbeddedResource Include="$(NugetPackageRoot)\sqlitepclraw.lib.e_sqlite3.v110_xp\1.1.13\runtimes\win-x86\native\e_sqlite3.dll"> | |
<Link>costura32\e_sqlite3.dll</Link> | |
</EmbeddedResource> | |
<EmbeddedResource Include="$(NugetPackageRoot)\sqlitepclraw.lib.e_sqlite3.v110_xp\1.1.13\runtimes\win-x64\native\e_sqlite3.dll"> | |
<Link>costura64\e_sqlite3.dll</Link> | |
</EmbeddedResource> | |
</ItemGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data.Entity; | |
using System.Data.Entity.Core.Common.CommandTrees; | |
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder; | |
using System.Data.Entity.Core.Metadata.Edm; | |
using System.Data.Entity.Infrastructure.Interception; | |
using System.Linq; | |
namespace gist | |
{ | |
/// Adapted from https://stackoverflow.com/questions/20133696/how-can-i-configure-entity-framework-to-automatically-trim-values-retrieved-for/27504530#27504530 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data.Entity; | |
using System.Reflection; | |
namespace gist | |
{ | |
public static class DbContextExtensions | |
{ | |
public static string GetProviderName(this DbContext context) | |
{ | |
var internalContextProperty = context.GetType().GetProperty("InternalContext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e -x | |
# For System.Data.SQLite to work on Mono, see https://stackoverflow.com/questions/21293105/system-dllnotfoundexception-on-mono-sqlite/43173220#43173220 | |
function Install_libSQLiteInterop | |
{ | |
# Latest version is on https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki | |
SQLITE_VERSION=1.0.111.0 | |
SQLITE_DYLIB=sqlite-netFx-source-${SQLITE_VERSION}/bin/2013/Release/bin/libSQLite.Interop.dylib | |
pushd ~/Downloads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace Parallel | |
{ | |
public static class EnumerableExtensions | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class MyContext | |
{ | |
// Adapted from https://blogs.infosupport.com/improving-dbentityvalidationexception/ | |
public override Task<int> SaveChangesAsync() | |
{ | |
try | |
{ | |
return base.SaveChangesAsync(); | |
} | |
catch (DbEntityValidationException exception) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Adapted from https://joris.kluivers.nl/blog/2014/02/10/storyboard-identifier-constants/ (https://github.com/kluivers/storyboard-constants) | |
# * Support for accessibility identifiers and accessibility labels | |
# * Easily extendable with xpath definitions | |
# * Valid identifiers | |
# * Namespaced constants, idea from https://www.mikeash.com/pyblog/friday-qa-2011-08-19-namespaced-constants-and-functions.html | |
PREFIX = '' | |
SPACING = '\t' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"People" : [ | |
"😀", | |
"😃", | |
"😄", | |
"😁", | |
"😆", | |
"😅", | |
"😂", | |
"🤣", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
static NSString * _Nonnull ActuallyLocalizedStringForStatusCode(NSInteger statusCode) | |
{ | |
static NSBundle *cfNetworkBundle; | |
static dispatch_once_t once; | |
dispatch_once(&once, ^{ | |
cfNetworkBundle = [NSBundle bundleForClass:NSHTTPURLResponse.class]; | |
}); | |
NSString *httpError = [NSHTTPURLResponse localizedStringForStatusCode:statusCode]; |