git add --patchgit fetch origin master| choco version all | |
| choco upgrade all --noop | |
| choco outdated |
| public class ConfigSettings : System.Dynamic.DynamicObject | |
| { | |
| private static readonly System.Lazy<ConfigSettings> _settings = new Lazy<ConfigSettings>(() => new ConfigSettings()); | |
| private ConfigSettings() | |
| { } | |
| public static dynamic Instance { get { return _settings.Value; } } | |
| public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result) |
| private static void LoadAndInit(string assemblyPath, string className) | |
| { | |
| var assembly = System.Reflection.Assembly.LoadFile(assemblyPath); | |
| RuntimeHelpers.RunClassConstructor(assembly.GetType(className).TypeHandle); | |
| } |
| package main | |
| import "fmt" | |
| // fib returns a function that returns | |
| // successive Fibonacci numbers. | |
| func fib() func(int) int { | |
| a, b := 0, 1 | |
| i := 0 | |
| return func(x int) int { |
| private static Dictionary<Type, Dictionary<string, object>> _propertyAccess = new Dictionary<Type, Dictionary<string, object>>(); | |
| private static void CacheProperties<T>() | |
| { | |
| if (_propertyAccess.ContainsKey(typeof(T))) | |
| return; | |
| _propertyAccess.Add(typeof(T), new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)); | |
| foreach (var prop in typeof(T).GetProperties()) |
| private Func<object, object> CreateInitFn(object obj) | |
| { | |
| var keyType = obj.GetType(); | |
| if (_initFn.ContainsKey(keyType)) | |
| { | |
| return _initFn[keyType]; | |
| } | |
| ParameterExpression xTmp = Expression.Variable(obj.GetType(), "tmp"); | |
| REPOS="$1" | |
| TXN="$2" | |
| # Make sure that the log message contains some text. | |
| SVNLOOK=/usr/bin/svnlook | |
| $SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" > /dev/null | |
| GREP_STATUS=$? | |
| if [ $GREP_STATUS -ne 0 ] | |
| then |
| @powershell -NoProfile -ExecutionPolicy unrestricted -Command "$a = new-object net.webclient; $a.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials;$a.DownloadString('https://chocolatey.org/install.ps1') | iex" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin |
| public class DisposableClass : IDisposable | |
| { | |
| bool _disposed; | |
| public void Dispose() | |
| { | |
| Dispose(true); | |
| GC.SuppressFinalize(this); | |
| } |