Skip to content

Instantly share code, notes, and snippets.

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 / 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>
@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 / 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 / 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 / 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 / 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);
<?xml version="1.0" encoding="utf-16"?>
<ShowPlanXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.2" Build="12.0.2000.8" xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan">
<BatchSequence>
<Batch>
<Statements>
<StmtSimple StatementCompId="1" StatementEstRows="1" StatementId="1" StatementOptmLevel="FULL" CardinalityEstimationModelVersion="120" StatementSubTreeCost="241.548" StatementText="SELECT TOP 1&#xD;&#xA; [Project1].[C1] AS [C1], &#xD;&#xA; [Project1].[Id] AS [Id], &#xD;&#xA; [Project1].[SupplierNumber] AS [SupplierNumber], &#xD;&#xA; [Project1].[ArticleNumber] AS [ArticleNumber], &#xD;&#xA; [Project1].[ArticleName] AS [ArticleName]&#xD;&#xA; FROM ( SELECT &#xD;&#xA; [Extent1].[SupplierNumber] AS [SupplierNumber], &#xD;&#xA; [Extent1].[ArticleNumber] AS [ArticleNumber], &#xD;&#xA; [Extent1].[Id] AS [Id], &#xD;&#xA; [Extent1].[ArticleName] AS [ArticleName], &#xD;&
msbuild /p:DeployOnBuild=true /p:PublishProfile=Staging /p:Password=agkamed /p:AllowUntrustedCertificate=true
@jtheisen
jtheisen / GlimpseServiceLocator.cs
Last active July 19, 2016 13:24
A ServiceLocator for Glimpse to improve startup time. *Doesn't work yet*!
using Glimpse.Core.Framework;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
namespace My
{
public class TypeRepository