Because Chrome DevTools snippets don't get saved...boo
also, for good reference: http://anti-code.com/devtools-cheatsheet/
| public static class HtmlRenderExtensions { | |
| /// <summary> | |
| /// Delegate script/resource/etc injection until the end of the page | |
| /// <para>@via http://stackoverflow.com/a/14127332/1037948 and http://jadnb.wordpress.com/2011/02/16/rendering-scripts-from-partial-views-at-the-end-in-mvc/ </para> | |
| /// </summary> | |
| private class DelayedInjectionBlock : IDisposable { | |
| /// <summary> | |
| /// Unique internal storage key | |
| /// </summary> |
| /// <summary> | |
| /// PGP round-trip encryption -- http://blogs.microsoft.co.il/kim/2009/01/23/pgp-zip-encrypted-files-with-c/#comment-611002 | |
| /// </summary> | |
| public class PGPEncryptDecrypt | |
| { | |
| /** | |
| * A simple routine that opens a key ring file and loads the first available key suitable for | |
| * encryption. | |
| * | |
| * @param in |
| using System.IO; | |
| // modified from RestSharp unit tests https://github.com/restsharp/RestSharp/blob/master/RestSharp.IntegrationTests/Helpers/SimpleServer.cs | |
| namespace UnitTesting | |
| { | |
| using System; | |
| using System.Net; | |
| using System.Security; | |
| using System.Threading; |
Because Chrome DevTools snippets don't get saved...boo
also, for good reference: http://anti-code.com/devtools-cheatsheet/
| public static class SqlObservations | |
| { | |
| public static IObservable<IEnumerable<IDataRecord>> MonitorChanges(string connectionString, string sql) | |
| { | |
| /* | |
| 1. read data from database and return results | |
| 2. monitor changes | |
| 3. when there is a change, repeat the whole process | |
| */ |
| public class JobInfoRepository : IDisposable | |
| { | |
| private readonly IDisposable _cleanUp; | |
| public IObservableCache<JobInfo, int> Results { get; } | |
| public JobInfoRepository() | |
| { | |
| var readWriteCache = new SourceCache<JobInfo, int>(ji => ji.JobID); | |
| Results = readWriteCache.AsObservableCache(); |
| set -x | |
| set -e | |
| # e.g. folder to process e.g. "frontend/" | |
| migration_folder=$1 | |
| find_regex=".*/*.tsx?" # mach all .ts and .tsx files | |
| # include trailing path "/" in folder parameter: e.g "frontend/" instead of just "frontend" | |
| ignore_path="*/$1node_modules/*" | |
| # Back up your files or change sed argument -i to -i.bak to generate backup files | |
| find $migration_folder -regextype posix-egrep -regex $find_regex -type f -not -path $ignore_path | xargs sed -i -E '/[(class)(")]/{ | |
| s/([mp])l(-[0-5])/\1s\2/g |
| // Includes a mini-program for checking and fixing files that have no extension | |
| // Only checks for the most common types | |
| // If you create a better version, please upload it here. | |
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| namespace AppendJPG | |
| { |
| public class ObservableValue<T> : INotifyPropertyChanged | |
| { | |
| public class MyArgs : PropertyChangedEventArgs | |
| { | |
| public MyArgs(string propertyName, T old, T @new) | |
| : base(propertyName) | |
| { | |
| Old = old; | |
| New = @new; | |
| } |
| using System.Xml; | |
| using System.Xml.Linq; | |
| namespace XmlLib | |
| { | |
| /// <summary> | |
| /// Provides extension methods for simple conversion between System.Xml and System.Xml.Linq classes. | |
| /// </summary> | |
| /// <remarks>From: http://brianary.blogspot.com/2010/02/converting-between-xdocument-and.html</remarks> | |
| public static class XmlLinqConversionExtensions |