Skip to content

Instantly share code, notes, and snippets.

View mcliment's full-sized avatar
⌨️

Marc Climent mcliment

⌨️
View GitHub Profile
@mcliment
mcliment / gist:2998743
Created June 26, 2012 20:33
Full example for Subgurim Maps v4
using System;
using System.Collections.Generic;
using System.Drawing;
using Subgurim.Controles;
namespace Demos.Utility
{
public partial class Clustered : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
@mcliment
mcliment / mapiconmaker.js
Created September 24, 2012 07:28
MapIconMaker for Google Maps API v3
/**
* @name MapIconMaker
* @version 2.0b
* @author Pamela Fox, Marc Climent
* @copyright (c) 2008 Pamela Fox, 2010 Marc Climent
* @fileoverview This gives you static functions for creating dynamically
* sized and colored marker icons using the Charts API marker output.
*/
/*
@mcliment
mcliment / Benchmark.cs
Last active December 17, 2023 11:18
Test to check the speed of List.ForEach vs List.AddRange
using System;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
namespace ForEachVsAddRange
{
[MemoryDiagnoser]
public class Benchmark
{
#!/usr/bin/python
# -*- coding: utf-8-1 -*-
import random, math
size = 1000
numOfStations = 10
minStationDistance = 5
minPointDistance = 200
using System;
using System.Collections.Generic;
using System.Linq;
namespace KataGasolinera
{
public class Point
{
public Point(int x, int y)
{
@mcliment
mcliment / FindUnused.ps1
Last active March 24, 2023 17:34
Powershell script to find unused files not referenced in solution
<#
.SYNOPSIS
Find and process files in a project folder that are not included in the project.
.DESCRIPTION
Find and process files in a project folder that are not included in the project.
Options to delete the files.
.PARAMETER Project
The path/name for the project file.
@mcliment
mcliment / NestedContainersAndSingletons.md
Last active August 29, 2015 14:16
Redefine singletons in StructureMap nested containers

This simple program just demonstrates that you can even redefine singletons in nested containers and they are destroyed when the nested container is disposed.

It just prints the HashCode of the instances twice -to ensure that they are defined as singletons-.

But this only works in StructureMap 2.6.x -actually because of a design flaw-, in 3.x branch throws a InvalidOperationException with the message:

Additional information: Only registrations of the default Transient, UniquePerRequest, and prebuilt objects are valid for nested containers. Remember that 'Transient' instances will be built once per nested container. If you need this functionality, try using a     Child/Profile container instead

NestedContainerSingletons.Singleton or plugin type NestedContainerSingletons.ISingleton has lifecycle Singleton
@mcliment
mcliment / rc2.js
Created February 18, 2016 12:33
Waiting for ASP.NET Core RC2
var http = require("https");
var openUrl = "/search/issues?q=user:aspnet+is:open+milestone:1.0.0-rc2";
var closedUrl = "/search/issues?q=user:aspnet+is:closed+milestone:1.0.0-rc2";
function getCount(url) {
return new Promise((resolve, reject) => {
var req = http.request({
hostname: "api.github.com",
path: url,
@mcliment
mcliment / AutomapperResolve.cs
Created July 5, 2016 15:10
Just showing an Automapper 5.0 inconsistency
using System;
using AutoMapper;
namespace SMBugSample
{
class Program
{
static void Main(string[] args)
{
var workingConfig = new MapperConfiguration(cfg =>
@mcliment
mcliment / WhatDoIHaveWithExplicitRegistration.txt
Created December 22, 2016 09:36
Diagnosing a problem with StructureMap
Nested Container: DEFAULT - Nested
==========================================================================================================================================================================================================================================================================================================================
PluginType Namespace Lifecycle Description Name
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ActionConstraintCache