Skip to content

Instantly share code, notes, and snippets.

View puf's full-sized avatar

Frank van Puffelen puf

View GitHub Profile
@puf
puf / index.html
Last active August 29, 2015 14:05
Chord chart with mail volumes
<html>
<head>
<style>
body {
font: 10px sans-serif;
}
.chord path {
fill-opacity: .67;
stroke: #000;
{"TrainingCenterDatabase":{
"Activities":{
"Activity":{
"@Sport":"Biking",
"Id":"2014-06-27T21:09:29Z",
"Lap":{
"@StartTime":"2014-06-27T21:09:29Z",
"TotalTimeSeconds":"1334",
"DistanceMeters":"10702.6",
"MaximumSpeed":"19.416",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@puf
puf / Unzip from LINQPad
Last active April 19, 2024 16:31
LINQPad script to unzip all files under a given directory
// This LINQPad script (easily converted into a regular C# program) extracts all zip files under a specific directory.
// makes use of the ZipUtility from http://linqpadsamples.codeplex.com/wikipage?title=Unzip%20a%20file%20using%20COM%20and%20dynamic
var files = Directory.EnumerateFiles(@"C:\Test Data\Gutenberg\pgdvd042010", "*.zip", SearchOption.AllDirectories).ToArray();
var dc = new DumpContainer().Dump();
var index=0;
var count=files.Count();
foreach (var file in files) {
dc.Content = string.Format("{0}/{1}: {2}", index++, count, file);
@puf
puf / Profiler.cs
Last active July 17, 2017 16:29
Tiny C# "manual" profiler (for those days that your proper profiler is proving too difficult to work with)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
public static class Profiler {
private static List<ProfilerFrame> stack = new List<ProfilerFrame>();
private static Dictionary<string, ProfiledBlock> totals = new Dictionary<string, ProfiledBlock>();
private static Action<string> logger;
@puf
puf / gist:1099750
Created July 22, 2011 16:11
Get the Component from a Tridion package
Component component = (Component) engine.GetObject(package.GetValue("Component.ID"));