This file contains hidden or 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 AppSettingsHelper | |
{ | |
/// <summary> | |
/// Get the value or type default | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="name"></param> | |
/// <returns></returns> | |
public static T GetValue<T>(string name) |
This file contains hidden or 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 class CommandLineHelper | |
{ | |
/// <summary> | |
/// Get value from command line | |
/// </summary> | |
/// <remarks> | |
/// Example: | |
/// GetCommandLineValue(args, "--START", out _startDate, DateTime.MinValue); | |
/// </remarks> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
/// <summary> | |
/// Split string on whitespace | |
/// </summary> | |
/// <remarks> | |
/// Faster than String.Split for large strings. | |
/// Results from splitting 1000 email text files | |
/// text.Split(new char[] {}, StringSplitOptions.RemoveEmptyEntries) | |
/// 00:00:00.0008075 2134951 Tokens StringHelper.SplitOnWhiteSpace | |
/// 00:00:00.3263374 2134951 Tokens String.Split | |
/// </remarks> |
This file contains hidden or 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
import os | |
import numpy | |
from pandas import DataFrame | |
from sklearn.feature_extraction.text import CountVectorizer | |
from sklearn.naive_bayes import MultinomialNB | |
from sklearn.pipeline import Pipeline | |
from sklearn.cross_validation import KFold | |
from sklearn.metrics import confusion_matrix, f1_score | |
NEWLINE = '\n' |
This file contains hidden or 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
/// <summary> | |
/// Map a resource "keyType" to polymorphic classes. | |
/// </summary> | |
/// <remarks> | |
/// Followed example here: | |
/// http://pastebin.com/9UweEKBe | |
/// </remarks> | |
public class CustomFieldDiscriminatorConvention : IDiscriminatorConvention | |
{ | |
private readonly string elementName; |
This file contains hidden or 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
/// <summary> | |
/// WebAPI add better browser support and pretty print. | |
/// </summary> | |
/// <remarks> | |
/// Usage: | |
/// WebApiConfig.Register() | |
/// config.Formatters.Add(new BrowserJsonFormatter()); | |
/// ... | |
/// | |
/// Source: |
This file contains hidden or 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
/// <summary> | |
/// Get all sequences of labels for a domain. | |
/// This finds "paypal.com" in "paypal.com.hacker.net". | |
/// </summary> | |
/// <remarks> | |
/// Inner loop is reversed so that returned list looks like a depth first search. | |
/// This is just a personal preference. | |
/// </remarks> | |
/// <param name="domain"></param> |
This file contains hidden or 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
/// <summary> | |
/// Get all labels of the domain. Item 0 is always TLD. | |
/// </summary> | |
/// <param name="domain"></param> | |
/// <returns></returns> | |
public static IEnumerable<string> GetDomainSubdomains(string domain) | |
{ | |
var parts = domain.Split('.').ToArray(); | |
var labels = new List<String>(parts.Length + 1); | |
for (var i = 0; i < parts.Length; i++) |
This file contains hidden or 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
namespace BloomFilter | |
{ | |
using System; | |
using System.Collections; | |
/// <summary> | |
/// Bloom filter. | |
/// </summary> | |
/// <typeparam name="T">Item type </typeparam> | |
public class Filter<T> |
NewerOlder