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
shortcuts2 = dict: | |
edit__comment = 'Ctrl+R,' | |
edit__copy = 'Ctrl+C,Ctrl+Insert' | |
edit__cut = 'Ctrl+X,Shift+Delete' | |
edit__dedent = 'Shift+Tab,' | |
edit__delete_line = 'Ctrl+D,' | |
edit__find_next = 'Ctrl+G,F3' | |
edit__find_or_replace = 'Ctrl+F,' | |
edit__find_previous = 'Ctrl+Shift+G,Shift+F3' |
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
def acronator(acronym, list_of_keywords): | |
pass |
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 argparse | |
parser = argparse.ArgumentParser(description='De-Generate Acronym') | |
parser.add_argument('acronym', metavar='ACR', | |
help='the acronym') | |
parser.add_argument('keywords', metavar='KEY', nargs='+', | |
help='some keywords') | |
args = parser.parse_args() |
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
#region INotifyPropertyChanged Boilerplate | |
public event PropertyChangedEventHandler PropertyChanged; | |
private void RaisePropertyChanged(string propname) | |
{ | |
PropertyChangedEventHandler handler = PropertyChanged; | |
if (handler != null) handler(this, new PropertyChangedEventArgs(propname)); | |
} |
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
// C# 6.0 and up: | |
public class PropertyChangedBase : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged = delegate { }; | |
protected void NotifyOfPropertyChange(string name) | |
{ | |
PropertyChanged(this, new PropertyChangedEventArgs(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 AssemblyResources | |
{ | |
public static bool ResourceExists(string resourceName) | |
{ | |
return Assembly.GetExecutingAssembly().GetManifestResourceNames().Contains(GetResourcePath(resourceName)); | |
} | |
public static string GetResourcePath(string resourceName) => $"{Assembly.GetExecutingAssembly().GetName().Name}.Resources.{resourceName}"; | |
public static Stream GetStream(string resourceName) |
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
# | |
# push_replace.ps1 | |
# | |
# This script is designed to produce customized release and debug nupkgs from a Visual Studio C# project. This is especially useful | |
# for nupkgs that include native DLLs that are different depending upon debug or release mode. | |
# | |
# How to use: | |
# In your .nuspec file in the <files> section, add the following line: | |
# <file src="$filelist$" target="lib\native" /> | |
# That line is set to go to lib\native because this script was made for handling native DLLs, but that target can be anything. |
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
# | |
# push.ps1 | |
# | |
# A simple script to package and push a Nuget package from a Visual Studio C# project. | |
# `nuget.exe` must be on the path or otherwise available to the script (Package Manager Console) | |
Set-Location -Path $PSScriptRoot | |
# project parameters | |
$projname = "MyProject" |
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> | |
/// Finds sections of the given IEnumerable<bool> that are continuously true | |
/// </summary> | |
/// <param name="src">Any IEnumerable<bool></param> | |
/// <returns>An IEnumerable<Tuple<int, int> where each pair represents the start and end index that is continuously true</returns> | |
private IEnumerable<Tuple<int, int>> FindContinuousTrue(IEnumerable<bool> src) | |
{ | |
var res = new Collection<Tuple<int, int>>(); | |
var srclist = src.ToList(); |
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> | |
/// Reserve the URL we'll be using for this session for a given user on a given domain | |
/// Source: http://stackoverflow.com/questions/14962334/httplistenerexception-access-denied-for-non-admins on Oct 09, 2014 | |
/// </summary> | |
/// <param name="address">URL (something like http://<ip_address>:<port>/)</param> | |
/// <param name="domain">Domain name (the current one is from Environment.UserDomainName)</param> | |
/// <param name="user">User name (the current one is from Environment.UserName)</param> | |
public static void AddAddress(this HttpListener listener, string address, string domain, string user) | |
{ | |
string args = string.Format(@"http add urlacl url={0}", address) + " user=\"" + domain + "\\" + user + "\""; |
OlderNewer