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
using System; | |
using System.Windows; | |
using System.Windows.Data; | |
namespace WpfConverters | |
{ | |
public class BooleanToVisibilityConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |
{ | |
if (!(value is bool)) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
<Title>ViewModel Property</Title> | |
<Author>Andre Guilherme</Author> | |
<Description>Creates a property that gets and sets the ViewModel (DataContext) of the object.</Description> |
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
using System.IO; | |
namespace Mniak.IO | |
{ | |
public class HybridStream : Stream | |
{ | |
private const long DEFAULT_THRESHOLD = 1 * 1024 * 1024; // 1 MB | |
private object streamLock = new object(); | |
private bool usingMemory; |
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
// https://gist.github.com/andregsilv/8e157583965b7af00d5ef975b9569cff | |
export class ThenElse<T> { | |
private done: boolean; | |
private value: any; | |
private failure: boolean; | |
private thenCallbacks = new Array<(value: T) => void>(); | |
private elseCallbacks = new Array<(value: any) => void>(); | |
constructor(task: (resolve: (value: T) => void, reject: (reason: any) => void) => void) { |
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
using Microsoft.Owin; | |
using Microsoft.Owin.Hosting; | |
using Owin; | |
using System; | |
using System.Threading.Tasks; | |
/* Used NuGet Packages | |
install-package Microsoft.Owin | |
install-package Microsoft.Owin.Host.HttpListener | |
install-package Microsoft.Owin.Hosting |
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
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true"> | |
<variable name="company_name" value="MyCompany" /> | |
<variable name="outdir" value="${specialfolder:folder=LocalApplicationData}/${var:company_name}/Logs/${var:program_name:default=Undefined}" /> | |
<variable name="layout" value="${longdate} | ${pad:padding=-15:${threadname:whenEmpty=${threadid}}} | ${pad:padding=-5:${level:uppercase=true}} | ${logger} | ${message}${onexception:inner= | ${exception:format=tostring}}"/> | |
<targets> | |
<target name="file_full" xsi:type="File" | |
layout="${var:layout}" | |
fileName="${var:outdir}/full.log" | |
archiveFileName="${var:outdir}/full.{#}.log" |
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
using System; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using System.Threading; | |
using System.Windows.Forms; | |
public void TypeKeys(string text, bool trimNums=true) { | |
if (trimNums) { | |
text = Regex.Replace(text, "[^0-9]", ""); | |
} |
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
# FOR MACOSX: curl -o ~/.bash_profile https://gist.githubusercontent.com/mniak/31cea1e0e50809dbb4e5dd13d689644c/raw/.bash_profile -H 'Cache-Control: no-cache' | |
# FOR LINUX: curl -o ~/.bashrc https://gist.githubusercontent.com/mniak/31cea1e0e50809dbb4e5dd13d689644c/raw/.bash_profile -H 'Cache-Control: no-cache' | |
export PS1="\[\e[33m\]\W\[\e[m\] \\$\[$(tput sgr0)\] " | |
export CLICOLOR=1 | |
export TERM=xterm-256color | |
export DOTNET_CLI_TELEMETRY_OPTOUT=1 | |
if [ $(uname) == "Darwin" ]; then #OSX specific configuration |
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
[FilterSet] | |
version=1 | |
filters\size=13 | |
filters\1\regexp=\\[Fatal\\] | |
filters\1\fore_colour=red | |
filters\1\back_colour=white | |
filters\2\regexp=\\| *[Ff][Aa][Tt][Aa][Ll] *\\| | |
filters\2\fore_colour=red | |
filters\2\back_colour=white |
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
/* | |
* Requires jQuery | |
* (c) Copyright Andre Soares (mniak) 2011-2018. All rights reserved. | |
* Licensed under MIT license (https://opensource.org/licenses/MIT) | |
*/ | |
(function($){ | |
$.fn.noteRange = function(options) { | |
var defaults = { | |
whiteColor: 'white', | |
blackColor: 'black', |
OlderNewer