Skip to content

Instantly share code, notes, and snippets.

@jtheisen
jtheisen / benchmark.cs
Created September 15, 2016 13:24
Value type generic performance benchmark
void Main()
{
var t1 = DateTime.Now;
TestGeneric(new GenericComparer<Int32>());
var t2 = DateTime.Now;
TestGeneral(new GenericComparer<Int32>());
var t3 = DateTime.Now;
TestGeneric(Comparer<Int32>.Default);
var t4 = DateTime.Now;
TestGeneral(Comparer<Int32>.Default);
@jtheisen
jtheisen / boxstarter.ps1
Last active February 21, 2022 11:10
My boxstarter
# Install with this from IE:
# http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/jtheisen/59fef5b48bcb415c5d77a3b86363e240/raw/294d8808123f3f1281bd814a4628caf1f16e1ff1/boxstarter.ps1
# choco feature enable -n=allowGlobalConfirmation
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Disable-BingSearch
# Remove Skydrive from the explorer root
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
@jtheisen
jtheisen / react-devextreme.tsx
Last active June 23, 2017 15:26
DevExtreme React wrappers
"use strict";
/*
This is a crude integration of DevExtreme widgets with React. There are many things that are missing,
but it is usable if you're willing to tinker with it once you encounter a problem.
In particular, watch out for the following issues:
* All options that are arrays or objects must be passed as reference, as
@jtheisen
jtheisen / intersperse.js
Created December 3, 2016 22:03
Lodash intersperse
function intersperse(a, f) {
var pairs = _.zip(
_.tail(a),
_.slice(a, 0, -1)
);
var inner = _.map(pairs, _.isFunction(f) ? _.spread(f) : _.constant(f));
var result = _.chain(a)
.zip(inner)
@jtheisen
jtheisen / index.html
Last active December 9, 2016 14:59
devextreme with mobx
<!-- Using DevExtreme with mobx outside React. -->
<div id="my-grid"></div>
<div id="my-button"></div>
<script>
var data = [
{
@jtheisen
jtheisen / ngen-msbuild.xml
Last active October 3, 2022 02:43
To be put in an AfterBuild task, it generates the necessary dummy files for ngen-ing a web application and gives the full shell commands to do it.
<!-- ngen -->
<Copy SourceFiles="$(MSBuildProjectDirectory)\Web.config" DestinationFiles="$(OutDir)$(AssemblyName).dummy.exe.config" />
<Copy SourceFiles="$(OutDir)$(AssemblyName).dll" DestinationFiles="$(OutDir)$(AssemblyName).dummy.exe" />
<GetFrameworkPath>
<Output
TaskParameter="Path"
PropertyName="FrameworkPath" />
</GetFrameworkPath>
<PropertyGroup>
<NgenUpdateCommand>&quot;$(FrameworkPath)\ngen.exe&quot; update</NgenUpdateCommand>
import plotly.offline as py
from plotly.graph_objs import *
import cmath
#from colorsys import *
import pandas as pd
import numpy
# Read data from a csv
z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv')
@jtheisen
jtheisen / clean.ps1
Created May 1, 2017 21:26
Remove Dropbox collision files
dir -Recurse | where { $_ -match "In Konflikt stehende Kopie" } | foreach { rm -Force $_.FullName }
using System;
using System.ComponentModel;
namespace AssemblyToProcess
{
#region The interfaces we need to define our implementations with.
// See sample below for an explanation of the type parameters.
public interface IPropertyImplementation<ValueInterface, ContainerInterface, Value, Container, MixIn>
Get-ChildItem -Recurse -Include bin,obj |? { $_.FullName -inotmatch 'node_modules' } | foreach { Remove-Item -Recurse $_ }