Skip to content

Instantly share code, notes, and snippets.

View breki's full-sized avatar

breki

  • https://scalablemaps.com
View GitHub Profile
@breki
breki / test_icebreaker.py
Created January 26, 2022 20:56
Unsuccessful attempt to get hypothesis working with test functions. The problem is that hypothesis does not revert changes to each `test_icebreaker` call, so the test assertion fails after the first run.
import pytest
from hypothesis import given
from hypothesis.strategies import booleans
from gp.models import MbsCompany
@pytest.fixture(scope="session")
def django_db_use_migrations(request) -> bool:
return False
.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Commit: b377529961
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\
@breki
breki / ShadingParameters.cs
Created February 27, 2019 04:40
Maperitive's ShadingParameters
using System;
using Brejc.Geometry;
namespace Brejc.DemLibrary.Shading
{
public class ShadingParameters
{
public int ShadingColor
{
get { return shadingColor; }
@breki
breki / IgorShadingMethod.cs
Created February 27, 2019 04:38
Maperitive's "Igor" shading method
using System;
using System.Drawing;
namespace Brejc.DemLibrary.Shading
{
public class IgorShadingMethod : IShadingMethod
{
public int MinAlpha
{
get { return minAlpha; }
@breki
breki / TilesAcceptanceTests2.cs
Created June 2, 2018 14:17
Problems with NCrunch and WebApplicationFactory
public class
TilesAcceptanceTests2 : IClassFixture<WebApplicationFactory<Startup>>
{
public TilesAcceptanceTests2(WebApplicationFactory<Startup> factory)
{
this.factory = factory.WithWebHostBuilder(
builder =>
{
builder.UseContentRoot(
@"E:\hg\serpentinite\serpentinite");
@breki
breki / CustomGrid.py
Created March 2, 2013 20:27
A Maperitive Python script for generating a simple rectangular grid on a map
# Places a simple rectangular grid based on the current map view (or geometry bounds).
# Author: Igor Brejc
# License: public domain
from maperipy import *
# A helper Python method for ranging with float values
def xfrange(start, stop, step):
while start < stop:
xmlWriter.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/1999/XMLSchema-instance");
@breki
breki / gist:364513
Created April 13, 2010 11:16
Windsor Castle: specify dependency explicitly using the fluent API
string inspectIncomingPackageCBName = "InspectIncomingPackageCircuitBreaker";
container.Register(Component.For<ICircuitBreaker>().ImplementedBy<SimpleCircuitBreaker>()
.Named(inspectIncomingPackageCBName).LifeStyle.Transient);
container.Register(
Component.For<InspectIncomingPackageTask>()
.ServiceOverrides(ServiceOverride.ForKey("circuitBreaker").Eq(inspectIncomingPackageCBName))
.LifeStyle.Transient);
@breki
breki / gist:364448
Created April 13, 2010 09:02
Windsor Castle XML configuration with TimeSpan parameter
<component id="InspectIncomingPackageCircuitBreaker">
<parameters>
<OpenPeriod>0:10:0</OpenPeriod>
</parameters>
</component>
@breki
breki / windsor.xml
Created April 13, 2010 08:50
Windsor Castle: fetching a list from XML configuration file
public class EngineConfiguration : IEngineConfiguration
{
public string DatabaseServer { get; set; }
public string DatabaseUsername { get; set; }
public string DatabasePassword { get; set; }
public IList<string> PluginAssemblies
{
get { return pluginAssemblies; }
}