Skip to content

Instantly share code, notes, and snippets.

@jdmonty
jdmonty / StringExtensions.Like
Last active December 26, 2015 19:59
c# string extension. I like 'like'
public static bool Like(this string @string, string pattern, char wildcard = '%', bool ignoreCase = true)
{
pattern = pattern.Replace(wildcard.ToString(), ".*");
var options = RegexOptions.Singleline | RegexOptions.Compiled;
if (ignoreCase) options |= RegexOptions.IgnoreCase;
var regex = new Regex(pattern, options);
return regex.IsMatch(@string);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web;
using System.Web.Hosting;
namespace PdfGenerator
{
public class PdfGenerator
@jdmonty
jdmonty / iisconfig.xml
Last active March 4, 2020 13:18
IIS html5 mode/pushState
<!-- https://coderwall.com/p/mycbiq -->
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
# Executes an IDbCommand and converts the resultset
# to a Powershell object collection
function ExecuteCommand(
$command = { throw 'Command must be supplied' }
){
$rows = @();
$reader = $command.executereader()
while($reader.read()){
$values = new-object object;
@echo off
: make-alias.cmd
if "%1" == "" goto usage:
for /F "usebackq" %%v in (`"powershell $M = ipmo -PassThru "%1" ; $M.ExportedCommands.Keys"`) do doskey %%v=powershell ipmo "%1" ; %%v $*
echo Aliases:
doskey /macros
goto done
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
In Flipboard's article[1], they kindly divulge their interpretation
of the summarization technique called LexRank[2].
While reading Flipboard's article, you can, if followed point by point,
reimplement their summarization algorithm.
Here are the steps/excerpts that stood out to me:
/// Markov chain that learns by observing data.
/// Let it observe a sequence of states.
/// Then you can ask it, given a state,
/// what are the probabilities of the next states occuring?
type MarkovChain (numStates : int) =
let mutable numObservations = 0
let mutable lastState = 0
let mutable matrix = Array2D.create numStates numStates (0, 0)
@jdmonty
jdmonty / devenv
Last active August 29, 2015 14:16
devenv boxstarter
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
cinst git
choco install powershell
choco install sysinternals
cinst googlechrome
cinst 7zip.install
choco install nodejs.install
choco install ruby
$/
  docs/
  src/
  tests/
  samples/
  artifacts/
  packages/
  build/
 lib/
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Rx ObservableAsPropertyHelper</Title>
<Shortcut>rxOAPH</Shortcut>
<Description>Code snippet for a ReactiveUI ObservableAsPropertyHelper</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>