This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
namespace AhoCorasickTree | |
{ | |
public class AhoCorasickTree | |
{ | |
internal AhoCorasickTreeNode Root { get; set; } | |
public AhoCorasickTree(IEnumerable<string> keywords) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using Microsoft.AspNetCore.Html; | |
using Newtonsoft.Json; | |
namespace HtmlHelpers | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Register-ScheduledTask ` | |
-Action (New-ScheduledTaskAction ` | |
-Execute ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe")."(default)") ` | |
-Argument 'https://github.com/trending') ` | |
-Trigger (New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -At 3am) ` | |
-TaskName "GitHub Trending" ` | |
-Description "Weekly check of GitHub trending repos." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here are some example usages for unimportant jobs we have where crap happens occasionally: | |
/// <summary> | |
/// intended for database commands that might deadlock, but are just "nice to haves"; we don't care if they deadlock every now and then | |
/// and we DON'T want them to block execution of the rest of /daily or /hourly! this returns -1 if deadlocked, otherwise, returns | |
/// the # of rows that the SQL command affected | |
/// </summary> | |
private int ExecuteIgnoreDeadlocks(string sql, object param = null, bool logDeadlock = false) | |
{ | |
try |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project DefaultTargets="PrepareStaticContent" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<!-- Passed in Parameters --> | |
<configuration></configuration> | |
<workingDir></workingDir> | |
<buildNumber></buildNumber> | |
<buildViews>false</buildViews> | |
<minifyJs>true</minifyJs> | |
<TargetsDirectory></TargetsDirectory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ObjectExtensions { | |
public static object ReflectValue(this object o, string path) { | |
// http://stackoverflow.com/a/4474015/1037948 | |
return path.Split('.').Aggregate(o, (current, component) => { | |
var property = current.GetType().GetProperty(component); | |
if(null == property) { | |
var field = current.GetType().GetField(component); | |
if(null == field) return null; | |
return field.GetValue(current); | |
} |